aGrUM  0.20.2
a C++ library for (probabilistic) graphical models
bijection.cpp
Go to the documentation of this file.
1 /**
2  *
3  * Copyright 2005-2020 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__
42  const BijectionIteratorSafe< int, int >*
44  static bool first_time = true;
45 
46  if (first_time) {
47  first_time = false;
49 # ifdef GUM_DEBUG_MODE
50  __debug__::dec_creation__("BijectionIteratorSafe",
51  "__bijection_static_end",
52  0,
53  "static variable correction",
54  0);
55  __debug__::dec_creation__("HashTableConstIteratorSafe",
56  "__bijection_static_end",
57  0,
58  "static variable correction",
59  0);
60 # endif
61  }
62 
64  }
65 
66  // creates (if needed) and returns the unsafe iterator BijectionIterEnd__
68  static bool first_time = true;
69 
70  if (first_time) {
71  first_time = false;
72  BijectionIterEnd__ = new BijectionIterator< int, int >;
73 # ifdef GUM_DEBUG_MODE
74  __debug__::dec_creation__("BijectionIterator",
75  "__bijection_static_end",
76  0,
77  "static variable correction",
78  0);
79  __debug__::dec_creation__("HashTableConstIterator",
80  "__bijection_static_end",
81  0,
82  "static variable correction",
83  0);
84 # endif
85  }
86 
87  return BijectionIterEnd__;
88  }
89 
90  // create the end iterator for all Bijections
91  const BijectionIteratorSafe< int, int >*
94 
95  // create the end iterator for all Bijections
96  const BijectionIterator< int, int >*
99 
100 } /* namespace gum */
101 
102 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
103 
104 
105 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
106 # ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
107 template class gum::Bijection< int, int >;
108 # endif
109 #endif
110 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
111 # ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
112 template class gum::Bijection< std::string, std::string >;
113 # endif
114 #endif
INLINE void emplace(Args &&... args)
Definition: set_tpl.h:669