LIBINT 2.7.2
class_registry.h
1/*
2 * Copyright (C) 2004-2021 Edward F. Valeev
3 *
4 * This file is part of Libint.
5 *
6 * Libint is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * Libint is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with Libint. If not, see <http://www.gnu.org/licenses/>.
18 *
19 */
20
21#ifndef _libint2_src_bin_libint_classregistry_h_
22#define _libint2_src_bin_libint_classregistry_h_
23
24#include <key.h>
25
26namespace libint2 {
27
30 public:
31 typedef KeyTypes::ClassID ClassID;
32 static ClassRegistry& Instance();
33 ClassID next_id() { return nclasses_++; }
34
35 private:
37 static ClassRegistry* registry_;
38 ClassID nclasses_;
39 };
40
44 template <typename T> class ClassInfo {
45 public:
46 typedef ClassRegistry::ClassID ClassID;
47
48 static ClassInfo& Instance()
49 {
50 if (!info_)
51 info_ = new ClassInfo;
52 return *info_;
53 }
54
56 {
57 }
58
59 ClassID id() const { return id_; }
60
61 private:
62 ClassInfo() :
63 id_(ClassRegistry::Instance().next_id())
64 {
65 }
66
67 static ClassInfo* info_;
68 ClassID id_;
69 };
70
71 template <typename T>
74
75};
76
77#endif
Objects of this type provide limited information about the class at runtime.
Definition: class_registry.h:44
This is a unique registry of classes.
Definition: class_registry.h:29
Defaults definitions for various parameters assumed by Libint.
Definition: algebra.cc:24
unsigned int ClassID
distinct classes have unique ClassID's
Definition: key.h:79