![]() |
aGrUM
0.20.3
a C++ library for (probabilistic) graphical models
|
A non scalar implementation of a Bijection. More...
#include <agrum/tools/core/bijection.h>
Public Member Functions | |
template<typename OtherAlloc > | |
INLINE void | _copy_ (const HashTable< T1, T2 *, OtherAlloc > &f2s) |
template<typename OtherAlloc > | |
INLINE | BijectionImplementation (const BijectionImplementation< T1, T2, OtherAlloc, Gen > &toCopy) |
template<typename OtherAlloc > | |
INLINE BijectionImplementation< T1, T2, Alloc, Gen > & | operator= (const BijectionImplementation< T1, T2, OtherAlloc, Gen > &toCopy) |
template<typename... Args> | |
INLINE void | emplace (Args &&... args) |
template<typename OtherAlloc > | |
INLINE void | _copy_ (const HashTable< T1, T2, OtherAlloc > &f2s) |
template<typename T1, typename T2, typename Alloc> | |
INLINE | BijectionImplementation (const BijectionImplementation< T1, T2, Alloc, true > &toCopy) |
template<typename OtherAlloc > | |
INLINE | BijectionImplementation (const BijectionImplementation< T1, T2, OtherAlloc, true > &toCopy) |
template<typename T1, typename T2, typename Alloc> | |
INLINE | BijectionImplementation (BijectionImplementation< T1, T2, Alloc, true > &&toCopy) noexcept |
template<typename OtherAlloc > | |
INLINE BijectionImplementation< T1, T2, Alloc, true > & | operator= (const BijectionImplementation< T1, T2, OtherAlloc, true > &toCopy) |
Constructors/destructors | |
~BijectionImplementation () | |
Destructor. More... | |
Accessors / Modifiers | |
const T1 & | first (const T2 &second) const |
Returns the first value of a pair given its second value. More... | |
const T1 & | firstWithDefault (const T2 &second, const T1 &default_val) const |
Returns the first value of a pair given its second value or default_val if second is unfound. More... | |
const T2 & | second (const T1 &first) const |
Returns the second value of a pair given its first value. More... | |
const T2 & | secondWithDefault (const T1 &second, const T2 &default_val) const |
Returns the second value of a pair given its first value or default_val if first is unfound. More... | |
bool | existsFirst (const T1 &first) const |
Returns true if first is the first element in a pair in the gum::Bijection. More... | |
bool | existsSecond (const T2 &second) const |
Returns true if second is the second element in a pair in the gum::Bijection. More... | |
void | insert (const T1 &first, const T2 &second) |
Inserts a new association in the gum::Bijection. More... | |
void | insert (T1 &&first, T2 &&second) |
Inserts a new association in the gum::Bijection. More... | |
template<typename... Args> | |
void | emplace (Args &&... args) |
Emplace a new element in the gum::Bijection. More... | |
void | clear () |
Removes all the associations from the gum::Bijection. More... | |
bool | empty () const noexcept |
Returns true if the gum::Bijection doesn't contain any association. More... | |
Size | size () const noexcept |
Returns the number of associations stored within the gum::Bijection. More... | |
void | eraseFirst (const T1 &first) |
Erases an association containing the given first element. More... | |
void | eraseSecond (const T2 &second) |
Erases an association containing the given second element. More... | |
std::string | toString () const |
Returns a friendly representatin of the gum::Bijection. More... | |
Fine tuning | |
Size | capacity () const noexcept |
Returns the number of hashtables slots used. More... | |
void | resize (Size new_size) |
Manually resize the gum::Bijection. More... | |
void | setResizePolicy (const bool new_policy) noexcept |
Change the gum::Bijection resizing policy. More... | |
bool | resizePolicy () const noexcept |
Returns true if the resize policy is automatic. More... | |
Public Types | |
using | type1_type = T1 |
types for STL compliance More... | |
using | type1_reference = T1 & |
types for STL compliance More... | |
using | type1_const_reference = const T1 & |
types for STL compliance More... | |
using | type1_pointer = T1 * |
types for STL compliance More... | |
using | type1_const_pointer = const T1 * |
types for STL compliance More... | |
using | type2_type = T2 |
types for STL compliance More... | |
using | type2_reference = T2 & |
types for STL compliance More... | |
using | type2_const_reference = const T2 & |
types for STL compliance More... | |
using | type2_pointer = T2 * |
types for STL compliance More... | |
using | type2_const_pointer = const T2 * |
types for STL compliance More... | |
using | size_type = std::size_t |
types for STL compliance More... | |
using | difference_type = std::ptrdiff_t |
types for STL compliance More... | |
using | allocator_type = Alloc |
types for STL compliance More... | |
using | iterator = BijectionIterator< T1, T2 > |
types for STL compliance More... | |
using | const_iterator = BijectionIterator< T1, T2 > |
types for STL compliance More... | |
using | iterator_safe = BijectionIteratorSafe< T1, T2 > |
types for STL compliance More... | |
using | const_iterator_safe = BijectionIteratorSafe< T1, T2 > |
types for STL compliance More... | |
using | allocator12_type = typename Alloc::template rebind< std::pair< T1, T2 *> >::other |
types for STL compliance More... | |
using | allocator21_type = typename Alloc::template rebind< std::pair< T2, T1 *> >::other |
types for STL compliance More... | |
Friends | |
class | BijectionIteratorSafe< T1, T2 > |
a friend to speed-up accesses More... | |
class | BijectionIterator< T1, T2 > |
a friend to speed-up accesses More... | |
class | Bijection< T1, T2, Alloc > |
a friend to speed-up accesses More... | |
template<typename TT1 , typename TT2 , typename A , bool > | |
class | BijectionImplementation |
a friend to speed-up accesses More... | |
Iterators | |
iterator | begin () const |
Returns the unsafe iterator at the beginning of the gum::Bijection. More... | |
const_iterator | cbegin () const |
Returns the constant unsafe iterator at the beginning of the gum::Bjection. More... | |
const iterator & | end () const noexcept |
Returns the unsafe iterator at the end of the gum::Bijection. More... | |
const const_iterator & | cend () const noexcept |
Returns the constant iterator at the end of the gum::Bijection. More... | |
iterator_safe | beginSafe () const |
Returns the safe iterator at the beginning of the gum::Bijection. More... | |
const_iterator_safe | cbeginSafe () const |
Returns the constant safe iterator at the begining of the gum::Bijection. More... | |
const iterator_safe & | endSafe () const noexcept |
Returns the safe iterator at the end of the gum::Bijection. More... | |
const const_iterator_safe & | cendSafe () const noexcept |
Returns the constant safe iterator at the end of the gum::Bijection. More... | |
static const iterator_safe & | endSafe4Statics () |
Returns the safe end iterator for other classes' statics. More... | |
static const iterator & | end4Statics () |
Returns the unsafe end iterator for other classes' statics. More... | |
A non scalar implementation of a Bijection.
This class is designed for modeling a gum::Bijection between two sets, the idea is following :
T1 | The first type of elements in the gum::Bjection. |
T2 | The second type of elements in the gum::Bjection. |
Alloc | The allocator used for allocating memory. |
Gen | If true, this will be replaced by a implementation omptimized for non-scalar types. |
Definition at line 84 of file bijection.h.
using gum::BijectionImplementation< T1, T2, Alloc, Gen >::allocator12_type = typename Alloc::template rebind< std::pair< T1, T2* > >::other |
types for STL compliance
Definition at line 105 of file bijection.h.
using gum::BijectionImplementation< T1, T2, Alloc, Gen >::allocator21_type = typename Alloc::template rebind< std::pair< T2, T1* > >::other |
types for STL compliance
Definition at line 106 of file bijection.h.
using gum::BijectionImplementation< T1, T2, Alloc, Gen >::allocator_type = Alloc |
types for STL compliance
Definition at line 100 of file bijection.h.
using gum::BijectionImplementation< T1, T2, Alloc, Gen >::const_iterator = BijectionIterator< T1, T2 > |
types for STL compliance
Definition at line 102 of file bijection.h.
using gum::BijectionImplementation< T1, T2, Alloc, Gen >::const_iterator_safe = BijectionIteratorSafe< T1, T2 > |
types for STL compliance
Definition at line 104 of file bijection.h.
using gum::BijectionImplementation< T1, T2, Alloc, Gen >::difference_type = std::ptrdiff_t |
types for STL compliance
Definition at line 99 of file bijection.h.
|
private |
Alias for more readable code.
Definition at line 635 of file bijection.h.
|
private |
Alias for more readable code.
Definition at line 636 of file bijection.h.
using gum::BijectionImplementation< T1, T2, Alloc, Gen >::iterator = BijectionIterator< T1, T2 > |
types for STL compliance
Definition at line 101 of file bijection.h.
using gum::BijectionImplementation< T1, T2, Alloc, Gen >::iterator_safe = BijectionIteratorSafe< T1, T2 > |
types for STL compliance
Definition at line 103 of file bijection.h.
using gum::BijectionImplementation< T1, T2, Alloc, Gen >::size_type = std::size_t |
types for STL compliance
Definition at line 98 of file bijection.h.
using gum::BijectionImplementation< T1, T2, Alloc, Gen >::type1_const_pointer = const T1* |
types for STL compliance
Definition at line 92 of file bijection.h.
using gum::BijectionImplementation< T1, T2, Alloc, Gen >::type1_const_reference = const T1& |
types for STL compliance
Definition at line 90 of file bijection.h.
using gum::BijectionImplementation< T1, T2, Alloc, Gen >::type1_pointer = T1* |
types for STL compliance
Definition at line 91 of file bijection.h.
using gum::BijectionImplementation< T1, T2, Alloc, Gen >::type1_reference = T1& |
types for STL compliance
Definition at line 89 of file bijection.h.
using gum::BijectionImplementation< T1, T2, Alloc, Gen >::type1_type = T1 |
types for STL compliance
Definition at line 88 of file bijection.h.
using gum::BijectionImplementation< T1, T2, Alloc, Gen >::type2_const_pointer = const T2* |
types for STL compliance
Definition at line 97 of file bijection.h.
using gum::BijectionImplementation< T1, T2, Alloc, Gen >::type2_const_reference = const T2& |
types for STL compliance
Definition at line 95 of file bijection.h.
using gum::BijectionImplementation< T1, T2, Alloc, Gen >::type2_pointer = T2* |
types for STL compliance
Definition at line 96 of file bijection.h.
using gum::BijectionImplementation< T1, T2, Alloc, Gen >::type2_reference = T2& |
types for STL compliance
Definition at line 94 of file bijection.h.
using gum::BijectionImplementation< T1, T2, Alloc, Gen >::type2_type = T2 |
types for STL compliance
Definition at line 93 of file bijection.h.
|
private |
Default constructor: creates a gum::Bijection without any association.
size | The Bijection starting size. |
resize_policy | If true, the gum::Bijection will resize itself automatically. |
Definition at line 83 of file bijection_tpl.h.
|
private |
Initializer list constructor.
list | The initialize list. |
Definition at line 101 of file bijection_tpl.h.
|
private |
Copy constructor.
toCopy | Bijection to copy. |
Definition at line 118 of file bijection_tpl.h.
|
private |
Generalized copy constructor.
toCopy | Bijection to copy. |
|
privatenoexcept |
Move constructor.
from | Bijection to move. |
Definition at line 139 of file bijection_tpl.h.
INLINE gum::BijectionImplementation< T1, T2, Alloc >::~BijectionImplementation | ( | ) |
Destructor.
Definition at line 148 of file bijection_tpl.h.
INLINE gum::BijectionImplementation< T1, T2, Alloc, Gen >::BijectionImplementation | ( | const BijectionImplementation< T1, T2, OtherAlloc, Gen > & | toCopy | ) |
Definition at line 129 of file bijection_tpl.h.
INLINE gum::BijectionImplementation< T1, T2, Alloc, Gen >::BijectionImplementation | ( | const BijectionImplementation< T1, T2, Alloc, true > & | toCopy | ) |
Definition at line 553 of file bijection_tpl.h.
INLINE gum::BijectionImplementation< T1, T2, Alloc, Gen >::BijectionImplementation | ( | const BijectionImplementation< T1, T2, OtherAlloc, true > & | toCopy | ) |
Definition at line 564 of file bijection_tpl.h.
|
noexcept |
Definition at line 574 of file bijection_tpl.h.
INLINE void gum::BijectionImplementation< T1, T2, Alloc, Gen >::_copy_ | ( | const HashTable< T1, T2 *, OtherAlloc > & | f2s | ) |
Definition at line 57 of file bijection_tpl.h.
INLINE void gum::BijectionImplementation< T1, T2, Alloc, Gen >::_copy_ | ( | const HashTable< T1, T2, OtherAlloc > & | f2s | ) |
Definition at line 532 of file bijection_tpl.h.
|
private |
A function that performs a complete copy of another gum::Bijection.
source | The source from copied into this gum::Bijection. |
OtherAlloc | The allocator used by source. |
|
private |
Inserts a new association into the gum::Bijection.
first | The first object in the association. |
second | The second object in the association. |
Definition at line 299 of file bijection_tpl.h.
|
private |
Inserts a new association into the gum::Bijection.
first | The first object in the association. |
second | The second object in the association. |
Definition at line 327 of file bijection_tpl.h.
INLINE BijectionImplementation< T1, T2, Alloc, true >::iterator gum::BijectionImplementation< T1, T2, Alloc >::begin | ( | ) | const |
Returns the unsafe iterator at the beginning of the gum::Bijection.
Unsafe iterators are a little bit faster than safe ones. But this speed is at the expense of safety: if you point to an element that is deleted, then try to access it or trying to operate a ++ will most certainly result in a segfault. So, Unsafe iterators should only be used to parse gum::Bjection where no element is ever deleted. If unsure, prefer using safe iterators.
Note that the notion of a beginning/end of a gum::Bjection is rather fuzzy. What is important here is that for an instance bij of this class:
Definition at line 215 of file bijection_tpl.h.
INLINE BijectionImplementation< T1, T2, Alloc, true >::iterator_safe gum::BijectionImplementation< T1, T2, Alloc >::beginSafe | ( | ) | const |
Returns the safe iterator at the beginning of the gum::Bijection.
Safe iterators are slightly slower than unsafe iterators. However, they guarantee that no segmentation fault can ever occur when trying to access the element they point to or when applying a ++ operator. When no element of the gum::Bijection is to be deleted during the parsing of the gum::Bijection (as for instance when you parse the gum::Bijection to display its content), prefer using the unsafe iterators, which are a little bit faster and cannot, in this case, produce segfaults.
Note that the notion of a beginning/end of a gum::Bijection is rather fuzzy. What is important here is that for an instance bij of this class:
Definition at line 245 of file bijection_tpl.h.
|
noexcept |
Returns the number of hashtables slots used.
Definition at line 429 of file bijection_tpl.h.
INLINE BijectionImplementation< T1, T2, Alloc, true >::const_iterator gum::BijectionImplementation< T1, T2, Alloc >::cbegin | ( | ) | const |
Returns the constant unsafe iterator at the beginning of the gum::Bjection.
Unsafe iterators are a little bit faster than safe ones. But this speed is at the expense of safety: if you point to an element that is deleted, then try to access it or trying to operate a ++ will most certainly result in a segfault. So, Unsafe iterators should only be used to parse gum::Bjection where no element is ever deleted. If unsure, prefer using safe iterators.
Note that the notion of a beginning/end of a gum::Bjection is rather fuzzy. What is important here is that for an instance bij of this class:
Definition at line 222 of file bijection_tpl.h.
INLINE BijectionImplementation< T1, T2, Alloc, true >::const_iterator_safe gum::BijectionImplementation< T1, T2, Alloc >::cbeginSafe | ( | ) | const |
Returns the constant safe iterator at the begining of the gum::Bijection.
Safe iterators are slightly slower than unsafe iterators. However, they guarantee that no segmentation fault can ever occur when trying to access the element they point to or when applying a ++ operator. When no element of the gum::Bijection is to be deleted during the parsing of the gum::Bijection (as for instance when you parse the bijection to display its content), prefer using the unsafe iterators, which are a little bit faster and cannot, in this case, produce segfaults.
Note that the notion of a beginning/end of a gum::Bijection is rather fuzzy. What is important here is that for an instance bij of this class:
Definition at line 252 of file bijection_tpl.h.
|
noexcept |
Returns the constant iterator at the end of the gum::Bijection.
Unsafe iterators are a little bit faster than safe ones. But this speed is at the expense of safety: if you point to an element that is deleted, then try to access it or trying to operate a ++ will most certainly result in a segfault. So, Unsafe iterators should only be used to parse gum::Bijection where no element is ever deleted. If unsure, prefer using safe iterators.
Note that the notion of a beginning/end of a gum::Bijection is rather fuzzy. What is important here is that for an instance bij of this class:
Definition at line 237 of file bijection_tpl.h.
|
noexcept |
Returns the constant safe iterator at the end of the gum::Bijection.
Safe iterators are slightly slower than unsafe iterators. However, they guarantee that no segmentation fault can ever occur when trying to access the element they point to or when applying a ++ operator. When no element of the gum::Bijection is to be deleted during the parsing of the gum::Bijection (as for instance when you parse the gum::Bijection to display its content), prefer using the unsafe iterators, which are a little bit faster and cannot, in this case, produce segfaults.
Note that the notion of a beginning/end of a gum::Bijection is rather fuzzy. What is important here is that for an instance bij of this class:
Definition at line 267 of file bijection_tpl.h.
INLINE void gum::BijectionImplementation< T1, T2, Alloc >::clear | ( | ) |
Removes all the associations from the gum::Bijection.
Definition at line 154 of file bijection_tpl.h.
INLINE void gum::BijectionImplementation< T1, T2, Alloc >::emplace | ( | Args &&... | args | ) |
Definition at line 390 of file bijection_tpl.h.
void gum::BijectionImplementation< T1, T2, Alloc, Gen >::emplace | ( | Args &&... | args | ) |
Emplace a new element in the gum::Bijection.
The emplace method allows to construct directly an element of type Key by passing to its constructor all the arguments it needs.
args | the arguments passed to the constructor |
DuplicateElement | exception is thrown if the association already exists |
|
noexcept |
Returns true if the gum::Bijection doesn't contain any association.
Definition at line 397 of file bijection_tpl.h.
|
noexcept |
Returns the unsafe iterator at the end of the gum::Bijection.
Unsafe iterators are a little bit faster than safe ones. But this speed is at the expense of safety: if you point to an element that is deleted, then try to access it or trying to operate a ++ will most certainly result in a segfault. So, Unsafe iterators should only be used to parse gum::Bijection where no element is ever deleted. If unsure, prefer using safe iterators.
Note that the notion of a beginning/end of a gum::Bijection is rather fuzzy. What is important here is that for an instance bij of this class:
Definition at line 229 of file bijection_tpl.h.
|
static |
Returns the unsafe end iterator for other classes' statics.
To reduce the gum::Bijection memory consumption (which are heavily used in aGrUM) while allowing fast for loops, end iterators are created just once as a static member of a non-template gum::Bijection. While this scheme is efficient and it works quite effectively, it has a drawback: other classes with static members using the BijectionImplementation::end() iterator may fail to work due to the well known "static initialization order fiasco" (see Marshall Cline's C++ FAQ for more details about this C++ feature).
So what is the problem? Consider a class, say X, containing a gum::Bijection that stores all its elements in a convenient way. To reduce memory consumption, X::end iterator is a static member that is initialized with a gum::Bijection::end iterator. If the compiler decides to initialize X::end before initializing gum::Bijection::end, then X::end will be in an incoherent state.
Unfortunately, we cannot know for sure in which order static members will be initialized (the order is a compiler's decision). Hence, we shall enfore the fact that gum::Bijection::end is initialized before X::end. Using method gum::Bijection::end4Statics will ensure this fact: it uses the C++ "construct on first use" idiom (see the C++ FAQ) that ensures that the order fiasco is avoided. More precisely, end4Statics uses a global variable that is the very end iterator used by all gum::Bijection. Now, this induces a small overhead. So, we also provide a gum::Bijection::end() method that returns the gum::Bijection::end iterator without this small overhead, but assuming that function end4Statics has already been called once (which is always the case) when a gum::Bijection has been created.
So, to summarize: when initializing static members use end4Statics() and in all the other cases, use end().
Definition at line 49 of file bijection_tpl.h.
|
noexcept |
Returns the safe iterator at the end of the gum::Bijection.
Safe iterators are slightly slower than unsafe iterators. However, they guarantee that no segmentation fault can ever occur when trying to access the element they point to or when applying a ++ operator. When no element of the gum::Bijection is to be deleted during the parsing of the gum::Bijection (as for instance when you parse the gum::Bijection to display its content), prefer using the unsafe iterators, which are a little bit faster and cannot, in this case, produce segfaults.
Note that the notion of a beginning/end of a gum::Bijection is rather fuzzy. What is important here is that for an instance bij of this class:
Definition at line 259 of file bijection_tpl.h.
|
static |
Returns the safe end iterator for other classes' statics.
To reduce the gum::Bijection memory consumption (which are heavily used in aGrUM) while allowing fast for loops, end iterators are created just once as a static member of a non-template gum::Bijection. While this scheme is efficient and it works quite effectively, it has a drawback: other classes with static members using the BijectionImplementation::end() iterator may fail to work due to the well known "static initialization order fiasco" (see Marshall Cline's C++ FAQ for more details about this C++ feature).
So what is the problem? Consider a class, say X, containing a gum::Bijection that stores all its elements in a convenient way. To reduce memory consumption, X::end iterator is a static member that is initialized with a gum::Bijection::end iterator. If the compiler decides to initialize X::end before initializing gum::Bijection::end, then X::end will be in an incoherent state.
Unfortunately, we cannot know for sure in which order static members will be initialized (the order is a compiler's decision). Hence, we shall enfore the fact that gum::Bijection::end is initialized before X::end. Using method gum::Bijection::end4Statics will ensure this fact: it uses the C++ "construct on first use" idiom (see the C++ FAQ) that ensures that the order fiasco is avoided. More precisely, end4Statics uses a global variable that is the very end iterator used by all gum::Bijection. Now, this induces a small overhead. So, we also provide a gum::Bijection::end() method that returns the gum::Bijection::end iterator without this small overhead, but assuming that function end4Statics has already been called once (which is always the case) when a gum::Bijection has been created.
So, to summarize: when initializing static members use endSafe4Statics() and in all the other cases, use endSafe().
Definition at line 42 of file bijection_tpl.h.
INLINE void gum::BijectionImplementation< T1, T2, Alloc >::eraseFirst | ( | const T1 & | first | ) |
Erases an association containing the given first element.
If the element cannot be found, nothing is done. In particular, no exception is raised.
first | The first element of a pair in the gum::Bijection. |
Definition at line 411 of file bijection_tpl.h.
INLINE void gum::BijectionImplementation< T1, T2, Alloc >::eraseSecond | ( | const T2 & | second | ) |
Erases an association containing the given second element.
If the element cannot be found, nothing is done. In particular, no exception is raised.
second | The second element of a pair in the gum::Bijection. |
Definition at line 420 of file bijection_tpl.h.
INLINE bool gum::BijectionImplementation< T1, T2, Alloc >::existsFirst | ( | const T1 & | first | ) | const |
Returns true if first is the first element in a pair in the gum::Bijection.
first | The element tested for existence. |
Definition at line 286 of file bijection_tpl.h.
INLINE bool gum::BijectionImplementation< T1, T2, Alloc >::existsSecond | ( | const T2 & | second | ) | const |
Returns true if second is the second element in a pair in the gum::Bijection.
second | The element tested for existence. |
Definition at line 292 of file bijection_tpl.h.
INLINE const T1 & gum::BijectionImplementation< T1, T2, Alloc >::first | ( | const T2 & | second | ) | const |
Returns the first value of a pair given its second value.
second | The second value of a pair in the gum::Bijection. |
NotFound | Raised if the element cannot be found. |
Definition at line 274 of file bijection_tpl.h.
INLINE const T1 & gum::BijectionImplementation< T1, T2, Alloc >::firstWithDefault | ( | const T2 & | second, |
const T1 & | default_val | ||
) | const |
Returns the first value of a pair given its second value or default_val if second is unfound.
second | The second value of a pair in the gum::Bijection. |
default_val | The default value returned if second is not in the gum::Bijection. |
Definition at line 356 of file bijection_tpl.h.
INLINE void gum::BijectionImplementation< T1, T2, Alloc, Gen >::insert | ( | const T1 & | first, |
const T2 & | second | ||
) |
Inserts a new association in the gum::Bijection.
The values are added by copy.
first | The first element of the pair to insert. |
second | The second element of the pair to insert. |
DuplicateElement | Raised if the association already exists. |
Definition at line 376 of file bijection_tpl.h.
INLINE void gum::BijectionImplementation< T1, T2, Alloc, Gen >::insert | ( | T1 && | first, |
T2 && | second | ||
) |
Inserts a new association in the gum::Bijection.
The values are moved in the gum::Bijection.
first | The first element of the pair to insert. |
second | The second element of the pair to insert. |
DuplicateElement | Raised if the association already exists. |
Definition at line 383 of file bijection_tpl.h.
|
private |
Copy operator.
toCopy | Bijection to copy. |
Definition at line 165 of file bijection_tpl.h.
|
private |
Generalized copy operator.
toCopy | Bijection to copy. |
|
private |
Move operator.
toCopy | Bijection to move |
Definition at line 197 of file bijection_tpl.h.
INLINE BijectionImplementation< T1, T2, Alloc, Gen >& gum::BijectionImplementation< T1, T2, Alloc, Gen >::operator= | ( | const BijectionImplementation< T1, T2, OtherAlloc, Gen > & | toCopy | ) |
Definition at line 183 of file bijection_tpl.h.
INLINE BijectionImplementation< T1, T2, Alloc, true >& gum::BijectionImplementation< T1, T2, Alloc, Gen >::operator= | ( | const BijectionImplementation< T1, T2, OtherAlloc, true > & | toCopy | ) |
Definition at line 678 of file bijection_tpl.h.
INLINE void gum::BijectionImplementation< T1, T2, Alloc >::resize | ( | Size | new_size | ) |
Manually resize the gum::Bijection.
See gum::HashTable::resize(gum::Size)
new_size | The gum::Bijection new size. |
Definition at line 435 of file bijection_tpl.h.
|
noexcept |
Returns true if the resize policy is automatic.
See gum::HashTable::resizePolicy().
Definition at line 450 of file bijection_tpl.h.
INLINE const T2 & gum::BijectionImplementation< T1, T2, Alloc >::second | ( | const T1 & | first | ) | const |
Returns the second value of a pair given its first value.
first | The first value of a pair in the gum::Bijection. |
NotFound | Raised if the element cannot be found. |
Definition at line 280 of file bijection_tpl.h.
INLINE const T2 & gum::BijectionImplementation< T1, T2, Alloc >::secondWithDefault | ( | const T1 & | second, |
const T2 & | default_val | ||
) | const |
Returns the second value of a pair given its first value or default_val if first is unfound.
second | The second value of a pair in the gum::Bijection. |
default_val | The default value returned if first is not in the gum::Bijection. |
Definition at line 367 of file bijection_tpl.h.
|
noexcept |
Change the gum::Bijection resizing policy.
See gum::HashTable::setResizePolicy( const bool );
new_policy | If true, the gum::Bijection will resize automatically. |
Definition at line 442 of file bijection_tpl.h.
|
noexcept |
Returns the number of associations stored within the gum::Bijection.
Definition at line 404 of file bijection_tpl.h.
std::string gum::BijectionImplementation< T1, T2, Alloc >::toString | ( | ) | const |
Returns a friendly representatin of the gum::Bijection.
Definition at line 456 of file bijection_tpl.h.
|
friend |
a friend to speed-up accesses
Definition at line 645 of file bijection.h.
|
friend |
a friend to speed-up accesses
Definition at line 643 of file bijection.h.
|
friend |
a friend to speed-up accesses
Definition at line 642 of file bijection.h.
|
friend |
a friend to speed-up accesses
Definition at line 641 of file bijection.h.
|
private |
The gum::HashTable associating T2 objects to T1 objects.
Definition at line 654 of file bijection.h.
|
private |
The gum::HashTable associating T1 objects to T2 objects.
Definition at line 657 of file bijection.h.