aGrUM  0.21.0
a C++ library for (probabilistic) graphical models
hashTable.cpp
Go to the documentation of this file.
1 /**
2  *
3  * Copyright (c) 2005-2021 by Pierre-Henri WUILLEMIN(@LIP6) & Christophe GONZALES(@AMU)
4  * info_at_agrum_dot_org
5  *
6  * This library is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser 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  * This library 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 Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this library. If not, see <http://www.gnu.org/licenses/>.
18  *
19  */
20 
21 
22 /**
23  * @file
24  * @brief Outlined implementation of hash tables.
25  *
26  * @author Christophe GONZALES(@AMU) and Pierre-Henri WUILLEMIN(@LIP6)
27  */
28 
29 #include <agrum/tools/core/hashTable.h>
30 
31 #ifdef GUM_DEBUG_MODE
32 # include <agrum/tools/core/debug.h>
33 #endif
34 
35 namespace gum {
36 
37 #ifndef DOXYGEN_SHOULD_SKIP_THIS
38 
40  static bool first_time = true;
41 
42  if (first_time) {
43  first_time = false;
44  _HashTableIterEnd_ = new HashTableIterator< int, int >;
45 # ifdef GUM_DEBUG_MODE
46  __debug__::_dec_creation_("HashTableIterator",
47  " __hash_static_end",
48  0,
49  "static variable correction",
50  0);
51  __debug__::_dec_creation_("HashTableConstIterator",
52  " __hash_static_end",
53  0,
54  "static variable correction",
55  0);
56 # endif
57  }
58 
59  return _HashTableIterEnd_;
60  }
61 
63  return reinterpret_cast< const HashTableConstIterator< int, int >* >(end4Statics());
64  }
65 
67  static bool first_time = true;
68 
69  if (first_time) {
70  first_time = false;
72 # ifdef GUM_DEBUG_MODE
73  __debug__::_dec_creation_("HashTableIteratorSafe",
74  " __hash_static_end",
75  0,
76  "static variable correction",
77  0);
78  __debug__::_dec_creation_("HashTableConstIteratorSafe",
79  " __hash_static_end",
80  0,
81  "static variable correction",
82  0);
83 # endif
84  }
85 
87  }
88 
90  return reinterpret_cast< const HashTableConstIteratorSafe< int, int >* >(endSafe4Statics());
91  }
92 
95 
98 
99 #endif // DOXYGEN_SHOULD_SKIP_THIS
100 
101 } /* namespace gum */
102 
103 
104 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
105 # ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
106 # ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
107 # ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
108 template class gum::HashTable< int, int >;
109 # endif
110 # endif
111 # endif
112 #endif
113 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
114 # ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
115 # ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
116 # ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
117 template class gum::HashTable< int, std::string >;
118 # endif
119 # endif
120 # endif
121 #endif
122 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
123 # ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
124 # ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
125 # ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
126 template class gum::HashTable< std::string, std::string >;
127 # endif
128 # endif
129 # endif
130 #endif
131 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
132 # ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
133 # ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
134 # ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
135 template class gum::HashTable< std::string, int >;
136 # endif
137 # endif
138 # endif
139 #endif
INLINE void emplace(Args &&... args)
Definition: set_tpl.h:643