52#ifndef GUM_BIJECTION_H
53#define GUM_BIJECTION_H
61#include <initializer_list>
66#ifndef DOXYGEN_SHOULD_SKIP_THIS
68 template <
typename T1,
typename T2 >
70 template <
typename T1,
typename T2 >
72 template <
typename T1,
typename T2,
bool >
74 template <
typename T1,
typename T2 >
103 template <
typename T1,
typename T2,
bool Gen >
469 template < typename... Args >
572 template < typename TT1, typename TT2,
bool >
614#ifndef DOXYGEN_SHOULD_SKIP_THIS
642 template <
typename T1,
typename T2 >
997 template <
typename... Args >
1011 bool empty()
const noexcept;
1100 template <
typename TT1,
typename TT2,
bool >
1145 template <
bool gen >
1152 template <
typename T >
1174 template <
typename T >
1193 template <
typename T1,
typename T2 >
1195 template <
typename TT1,
typename TT2,
bool >
1229 template <
bool Gen >
1243#ifndef DOXYGEN_SHOULD_SKIP_THIS
1354 const T1& first() const;
1362 const T2& second() const;
1369 typename
std::conditional<
std::is_scalar< T1 >::value &&
std::is_scalar< T2 >::value,
1393 template < typename T1, typename T2 >
1395 template <
typename TT1,
typename TT2,
bool >
1427 template <
bool Gen >
1441#ifndef DOXYGEN_SHOULD_SKIP_THIS
1548 const T1& first() const;
1556 const T2& second() const;
1563 typename
std::conditional<
std::is_scalar< T1 >::value &&
std::is_scalar< T2 >::value,
1590 template < typename T1, typename T2 >
1594 std::is_scalar< T1 >::value &&
std::is_scalar< T2 >::value > {
1620 std::is_scalar< T1 >::value && std::is_scalar< T2 >::value >;
1641 Bijection(std::initializer_list< std::pair< T1, T2 > > list);
1683#ifndef DOXYGEN_SHOULD_SKIP_THIS
1695 inline constexpr void*
const _Bijection_end_ = (
void*
const)&_static_Bijection_end_;
1696 inline constexpr void*
const _Bijection_end_safe_ = (
void*
const)&_static_Bijection_end_safe_;
1708 template <
typename T1,
typename T2 >
1714#ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
Class providing generic double hash tables.
A non scalar implementation of a Bijection.
void emplace(Args &&... args)
const iterator & end() const noexcept
Returns the unsafe iterator at the end of the gum::Bijection.
const T1 & firstWithDefault(const T2 &second, const T1 &default_val) const
BijectionIteratorSafe< T1, T2 > iterator_safe
types for STL compliance
BijectionImplementation(const BijectionImplementation< T1, T2, Gen > &toCopy)
Copy constructor.
BijectionImplementation< T1, T2, Gen > & operator=(BijectionImplementation< T1, T2, Gen > &&toCopy)
Move operator.
T1 type1_type
types for STL compliance
void eraseSecond(const T2 &second)
std::size_t size_type
types for STL compliance
const T2 * type2_const_pointer
types for STL compliance
const iterator_safe & endSafe() const noexcept
BijectionIteratorSafe< T1, T2 > const_iterator_safe
types for STL compliance
HashTable12 _firstToSecond_
HashTable12::value_type * _insert_(const T1 &first, const T2 &second)
HashTable< T2, T1 * > HashTable21
Alias for more readable code.
~BijectionImplementation()
Destructor.
void _copy_(const HashTable< T1, T2 * > &source)
void eraseFirst(const T1 &first)
std::ptrdiff_t difference_type
types for STL compliance
BijectionIterator< T1, T2 > const_iterator
types for STL compliance
T2 * type2_pointer
types for STL compliance
const const_iterator_safe & cendSafe() const noexcept
BijectionImplementation(std::initializer_list< std::pair< T1, T2 > > list)
Initializer list constructor.
iterator begin() const
Returns the unsafe iterator at the beginning of the gum::Bijection.
bool existsFirst(const T1 &first) const
const T1 * type1_const_pointer
types for STL compliance
Size capacity() const noexcept
HashTable21 _secondToFirst_
BijectionImplementation(Size size, bool resize_policy)
Default constructor: creates a gum::Bijection without any association.
std::string toString() const
const T1 & type1_const_reference
types for STL compliance
const T2 & type2_const_reference
types for STL compliance
BijectionIterator< T1, T2 > iterator
types for STL compliance
T2 type2_type
types for STL compliance
const_iterator_safe cbeginSafe() const
T2 & type2_reference
types for STL compliance
T1 & type1_reference
types for STL compliance
void insert(const T1 &first, const T2 &second)
bool empty() const noexcept
const const_iterator & cend() const noexcept
void setResizePolicy(const bool new_policy) noexcept
friend class BijectionIterator< T1, T2 >
a friend to speed-up accesses
const_iterator cbegin() const
Returns the constant unsafe iterator at the beginning of the gum::Bjection.
Size size() const noexcept
friend class Bijection< T1, T2 >
a friend to speed-up accesses
const T2 & secondWithDefault(const T1 &second, const T2 &default_val) const
BijectionImplementation(BijectionImplementation< T1, T2, Gen > &&from) noexcept
Move constructor.
HashTable< T1, T2 * > HashTable12
Alias for more readable code.
const T1 & first(const T2 &second) const
void resize(Size new_size)
BijectionImplementation< T1, T2, Gen > & operator=(const BijectionImplementation< T1, T2, Gen > &toCopy)
Copy operator.
T1 * type1_pointer
types for STL compliance
const T2 & second(const T1 &first) const
bool existsSecond(const T2 &second) const
friend class BijectionIteratorSafe< T1, T2 >
a friend to speed-up accesses
iterator_safe beginSafe() const
friend class BijectionImplementation
a friend to speed-up accesses
bool resizePolicy() const noexcept
Safe iterators for bijectionIterator.
T2 * type2_pointer
types for STL compliance
HashIter _iter_
The hashTable iterator that actually does all the job.
const T1 * type1_const_pointer
types for STL compliance
typename HashTable12::const_iterator_safe HashIter
Alias for one of the internal gum::HastTableIterator of the gum::Bijection.
BijectionIteratorGet< std::is_scalar< T1 >::value &&std::is_scalar< T2 >::value > Getter
Dummy classes that will enable discriminate without overhead between scalars and non-scalars function...
const T1 & type1_const_reference
types for STL compliance
T1 * type1_pointer
types for STL compliance
const T2 & type2_const_reference
types for STL compliance
T1 & type1_reference
types for STL compliance
BijectionIteratorSafe(const BijectionImplementation< T1, T2, Gen > &bijection)
Begin constructor.
T1 type1_type
types for STL compliance
const T2 * type2_const_pointer
types for STL compliance
typename std::conditional< std::is_scalar< T1 >::value &&std::is_scalar< T2 >::value, HashTable< T1, T2 >, HashTable< T1, T2 * > >::type HashTable12
Alias for one of the internal gum::HashTable of the gum::Bijection.
std::ptrdiff_t difference_type
types for STL compliance
T2 type2_type
types for STL compliance
std::forward_iterator_tag iterator_category
types for STL compliance
friend class BijectionImplementation
T2 & type2_reference
types for STL compliance
Unsafe iterators for bijection.
T1 * type1_pointer
types for STL compliance
T1 type1_type
types for STL compliance
typename std::conditional< std::is_scalar< T1 >::value &&std::is_scalar< T2 >::value, HashTable< T1, T2 >, HashTable< T1, T2 * > >::type HashTable12
Alias for one of the internal gum::HashTable of the gum::Bijection.
BijectionIterator(const BijectionImplementation< T1, T2, Gen > &bijection)
Begin constructor.
typename HashTable12::const_iterator HashIter
T2 * type2_pointer
types for STL compliance
T1 & type1_reference
types for STL compliance
T2 & type2_reference
types for STL compliance
const T2 & type2_const_reference
types for STL compliance
const T1 & type1_const_reference
types for STL compliance
BijectionIteratorGet< std::is_scalar< T1 >::value &&std::is_scalar< T2 >::value > Getter
Dummy classes that will enable discriminate without overhead between scalars and non-scalars function...
T2 type2_type
types for STL compliance
HashIter _iter_
The hashTable iterator that actually does all the job.
std::ptrdiff_t difference_type
types for STL compliance
std::forward_iterator_tag iterator_category
types for STL compliance
const T1 * type1_const_pointer
types for STL compliance
const T2 * type2_const_pointer
types for STL compliance
friend class BijectionImplementation
Set of pairs of elements with fast search for both elements.
const T1 * type1_const_pointer
types for STL compliance
BijectionImplementation< T1, T2, std::is_scalar< T1 >::value &&std::is_scalar< T2 >::value > Implementation
The Implementation of this gum::Bijection.
T2 & type2_reference
types for STL compliance
T2 * type2_pointer
types for STL compliance
const T1 & type1_const_reference
types for STL compliance
BijectionIteratorSafe< T1, T2 > iterator_safe
types for STL compliance
BijectionIteratorSafe< T1, T2 > const_iterator_safe
types for STL compliance
T2 type2_type
types for STL compliance
T1 * type1_pointer
types for STL compliance
Bijection(Size size=HashTableConst::default_size, bool resize_policy=HashTableConst::default_resize_policy)
Default constructor: creates a gum::Bijection without any association.
std::ptrdiff_t difference_type
types for STL compliance
const T2 * type2_const_pointer
types for STL compliance
Bijection< const DiscreteVariable *, const DiscreteVariable * > & operator=(const Bijection< const DiscreteVariable *, const DiscreteVariable * > &toCopy)
T1 type1_type
types for STL compliance
const T2 & type2_const_reference
types for STL compliance
T1 & type1_reference
types for STL compliance
BijectionIterator< T1, T2 > const_iterator
types for STL compliance
BijectionIterator< T1, T2 > iterator
types for STL compliance
std::size_t size_type
types for STL compliance
The class for generic Hash Tables.
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Class hash tables iterators.
gum is the global namespace for all aGrUM entities
static INLINE const T & op_second(const T &x)
Returns a reference.
Dummy classes for discriminating scalars and non-scalars operators and -> wihtout any overhead.
static INLINE const T & op_second(const T *x)
Returns a refeence over a pointer.
static constexpr Size default_size
The default number of slots in hashtables.
static constexpr bool default_resize_policy
A Boolean indicating whether inserting too many values into the hashtable makes it resize itself auto...
std::ostream & operator<<(std::ostream &out, const TiXmlNode &base)