aGrUM  0.21.0
a C++ library for (probabilistic) graphical models
bijection.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 Bijections
25  *
26  * @author Christophe GONZALES(@AMU) and Pierre-Henri WUILLEMIN(@LIP6)
27  */
28 
29 #include <string>
30 
31 #include <agrum/tools/core/bijection.h>
32 
33 #ifdef GUM_DEBUG_MODE
34 # include <agrum/tools/core/debug.h>
35 #endif
36 
37 #ifndef DOXYGEN_SHOULD_SKIP_THIS
38 
39 namespace gum {
40 
41  // creates (if needed) and returns the safe iterator _BijectionIterEndSafe_
43  static bool first_time = true;
44 
45  if (first_time) {
46  first_time = false;
48 # ifdef GUM_DEBUG_MODE
49  __debug__::_dec_creation_("BijectionIteratorSafe",
50  " __bijection_static_end",
51  0,
52  "static variable correction",
53  0);
54  __debug__::_dec_creation_("HashTableConstIteratorSafe",
55  " __bijection_static_end",
56  0,
57  "static variable correction",
58  0);
59 # endif
60  }
61 
63  }
64 
65  // creates (if needed) and returns the unsafe iterator _BijectionIterEnd_
67  static bool first_time = true;
68 
69  if (first_time) {
70  first_time = false;
71  _BijectionIterEnd_ = new BijectionIterator< int, int >;
72 # ifdef GUM_DEBUG_MODE
73  __debug__::_dec_creation_("BijectionIterator",
74  " __bijection_static_end",
75  0,
76  "static variable correction",
77  0);
78  __debug__::_dec_creation_("HashTableConstIterator",
79  " __bijection_static_end",
80  0,
81  "static variable correction",
82  0);
83 # endif
84  }
85 
86  return _BijectionIterEnd_;
87  }
88 
89  // create the end iterator for all Bijections
92 
93  // create the end iterator for all Bijections
96 
97 } /* namespace gum */
98 
99 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
100 
101 
102 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
103 # ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
104 template class gum::Bijection< int, int >;
105 # endif
106 #endif
107 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
108 # ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
109 template class gum::Bijection< std::string, std::string >;
110 # endif
111 #endif
INLINE void emplace(Args &&... args)
Definition: set_tpl.h:643