LIBINT 2.9.0
class_registry.h
1/*
2 * Copyright (C) 2004-2024 Edward F. Valeev
3 *
4 * This file is part of Libint compiler.
5 *
6 * Libint compiler 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 compiler 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 compiler. 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
45template <typename T>
46class ClassInfo {
47 public:
48 typedef ClassRegistry::ClassID ClassID;
49
50 static ClassInfo& Instance() {
51 if (!info_) info_ = new ClassInfo;
52 return *info_;
53 }
54
55 ~ClassInfo() {}
56
57 ClassID id() const { return id_; }
58
59 private:
60 ClassInfo() : id_(ClassRegistry::Instance().next_id()) {}
61
62 static ClassInfo* info_;
63 ClassID id_;
64};
65
66template <typename T>
68
69}; // namespace libint2
70
71#endif
Objects of this type provide limited information about the class at runtime.
Definition class_registry.h:46
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:83