aGrUM  0.20.2
a C++ library for (probabilistic) graphical models
gum::ListBucket< Val > Class Template Reference

Bucket for a chained list. More...

#include <agrum/tools/core/list.h>

Public Member Functions

template<typename... Args>
INLINE ListBucket (typename ListBucket< Val >::Emplace, Args &&... args)
 
Constructors / Destructors
 ListBucket ()=delete
 Removes empty constructor. More...
 
 ListBucket (const Val &v)
 Default constructor. More...
 
 ListBucket (Val &&v) noexcept
 Constructor for Val rvalues. More...
 
template<typename... Args>
 ListBucket (Emplace, Args &&... args)
 Emplace (universal) constructor. More...
 
 ListBucket (const ListBucket< Val > &src)
 Copy constructor. More...
 
 ListBucket (ListBucket< Val > &&src)=delete
 Move constructor should be useless. More...
 
 ~ListBucket ()
 Class destructor. More...
 
Operators
ListBucket< Val > & operator= (const ListBucket< Val > &src)
 Copy operator. More...
 
ListBucket< Val > & operator= (ListBucket< Val > &&src)=delete
 Move operator. More...
 
bool operator== (const ListBucket< Val > &src) const
 Equality check. More...
 
bool operator!= (const ListBucket< Val > &src) const
 Inequality check. More...
 
Accessors / Modifiers
Val & operator* () noexcept
 Dereferencing operator. More...
 
const Val & operator* () const noexcept
 Dereferencing operator. More...
 
const ListBucket< Val > * next () const noexcept
 Returns the bucket toward the next element. More...
 
const ListBucket< Val > * previous () const noexcept
 Returns the bucket toward the preceding element. More...
 

Friends

template<typename T , typename A >
class List
 All the list containers and iterators should be able to access the buckets. More...
 
class ListIterator< Val >
 
class ListConstIterator< Val >
 
class ListIteratorSafe< Val >
 
class ListConstIteratorSafe< Val >
 

Detailed Description

template<typename Val>
class gum::ListBucket< Val >

Bucket for a chained list.

In aGrUM, each box of a chained list is called a bucket. Lists are doubly linked bucket lists so as to enable efficient rbegin/rend iterators.

Warning
Values stored in buckets are ALWAYS COPIES.
Template Parameters
ValThe values type stored in the gum::ListBucket.

Definition at line 104 of file list.h.

Member Enumeration Documentation

◆ Emplace

template<typename Val>
enum gum::ListBucket::Emplace
strongprivate

C dummy type for the emplace constructor.

This type is used to prevent the list emplace (int) to compile.

Enumerator
EMPLACE 

Definition at line 111 of file list.h.

112  { EMPLACE };

Constructor & Destructor Documentation

◆ ListBucket() [1/7]

template<typename Val>
gum::ListBucket< Val >::ListBucket ( )
delete

Removes empty constructor.

◆ ListBucket() [2/7]

template<typename Val>
INLINE gum::ListBucket< Val >::ListBucket ( const Val &  v)
explicit

Default constructor.

Parameters
vThe value stored in the gum::ListBucket.

Definition at line 42 of file list_tpl.h.

42  : val__{v} {
43  // for debugging purposes
44  GUM_CONSTRUCTOR(ListBucket);
45  }
Val val__
Val is the value contained in the box.
Definition: list.h:249
ListBucket()=delete
Removes empty constructor.

◆ ListBucket() [3/7]

template<typename Val>
INLINE gum::ListBucket< Val >::ListBucket ( Val &&  v)
explicitnoexcept

Constructor for Val rvalues.

Parameters
vThe value stored in the gum::ListBucket.

Definition at line 49 of file list_tpl.h.

49  : val__{std::move(v)} {
50  // for debugging purposes
51  GUM_CONSTRUCTOR(ListBucket);
52  }
Val val__
Val is the value contained in the box.
Definition: list.h:249
ListBucket()=delete
Removes empty constructor.

◆ ListBucket() [4/7]

template<typename Val>
template<typename... Args>
gum::ListBucket< Val >::ListBucket ( Emplace  ,
Args &&...  args 
)
explicit

Emplace (universal) constructor.

Template Parameters
ArgsThe emplace values type.
Parameters
argsThe emplace values.

◆ ListBucket() [5/7]

template<typename Val>
INLINE gum::ListBucket< Val >::ListBucket ( const ListBucket< Val > &  src)

Copy constructor.

Parameters
srcThe gum::ListBucket to copy.

Definition at line 66 of file list_tpl.h.

66  :
67  val__{src.val__} {
68  // for debugging purposes
69  GUM_CONS_CPY(ListBucket);
70  }
Val val__
Val is the value contained in the box.
Definition: list.h:249
ListBucket()=delete
Removes empty constructor.

◆ ListBucket() [6/7]

template<typename Val>
gum::ListBucket< Val >::ListBucket ( ListBucket< Val > &&  src)
delete

Move constructor should be useless.

Parameters
srcThe gum::ListBucket to move.

◆ ~ListBucket()

template<typename Val >
INLINE gum::ListBucket< Val >::~ListBucket ( )

Class destructor.

Warning
during its deletion, the bucket takes care of properly rechaining the chained list. However, it has no knowledge about the variables that keep track of the beginning/end of the chained list, hence it cannot update them properly. This should be done by the List itself.

Definition at line 87 of file list_tpl.h.

87  {
88  // for debugging purposes
89  GUM_DESTRUCTOR(ListBucket);
90  }
ListBucket()=delete
Removes empty constructor.

◆ ListBucket() [7/7]

template<typename Val>
template<typename... Args>
INLINE gum::ListBucket< Val >::ListBucket ( typename ListBucket< Val >::Emplace  ,
Args &&...  args 
)

Definition at line 57 of file list_tpl.h.

58  :
59  val__(std::forward< Args >(args)...) {
60  // for debugging purposes
61  GUM_CONSTRUCTOR(ListBucket);
62  }
Val val__
Val is the value contained in the box.
Definition: list.h:249
ListBucket()=delete
Removes empty constructor.

Member Function Documentation

◆ next()

template<typename Val >
INLINE const ListBucket< Val > * gum::ListBucket< Val >::next ( ) const
noexcept

Returns the bucket toward the next element.

Returns
Returns the bucket toward the next element.

Definition at line 118 of file list_tpl.h.

118  {
119  return next__;
120  }
ListBucket< Val > * next__
Chaining toward the adjacent elements.
Definition: list.h:245

◆ operator!=()

template<typename Val>
INLINE bool gum::ListBucket< Val >::operator!= ( const ListBucket< Val > &  src) const

Inequality check.

Parameters
srcThe gum::ListBucket to test for inequality.
Returns
Returns true if src and this gum::ListBucket are not equal.

Definition at line 100 of file list_tpl.h.

100  {
101  return (src.val__ != val__);
102  }
Val val__
Val is the value contained in the box.
Definition: list.h:249

◆ operator*() [1/2]

template<typename Val >
INLINE Val & gum::ListBucket< Val >::operator* ( )
noexcept

Dereferencing operator.

Returns
The value stored in this gum::ListBucket.

Definition at line 112 of file list_tpl.h.

112  {
113  return val__;
114  }
Val val__
Val is the value contained in the box.
Definition: list.h:249

◆ operator*() [2/2]

template<typename Val >
INLINE const Val & gum::ListBucket< Val >::operator* ( ) const
noexcept

Dereferencing operator.

Returns
The value stored in this gum::ListBucket.

Definition at line 106 of file list_tpl.h.

106  {
107  return val__;
108  }
Val val__
Val is the value contained in the box.
Definition: list.h:249

◆ operator=() [1/2]

template<typename Val>
INLINE ListBucket< Val > & gum::ListBucket< Val >::operator= ( const ListBucket< Val > &  src)

Copy operator.

Parameters
srcThe gum::ListBucket to copy.
Returns
This gum::ListBucket.

Definition at line 75 of file list_tpl.h.

75  {
76  // for debugging purposes
77  GUM_OP_CPY(ListBucket);
78 
79  // no need to avoid self assignment
80  val__ = src.val__;
81  return *this;
82  }
Val val__
Val is the value contained in the box.
Definition: list.h:249
ListBucket()=delete
Removes empty constructor.

◆ operator=() [2/2]

template<typename Val>
ListBucket< Val >& gum::ListBucket< Val >::operator= ( ListBucket< Val > &&  src)
delete

Move operator.

Parameters
srcThe gum::ListBucket to move.
Returns
This gum::ListBucket.

◆ operator==()

template<typename Val>
INLINE bool gum::ListBucket< Val >::operator== ( const ListBucket< Val > &  src) const

Equality check.

Parameters
srcThe gum::ListBucket to test for equality.
Returns
Returns true if src and this gum::ListBucket are equal.

Definition at line 94 of file list_tpl.h.

94  {
95  return (src.val__ == val__);
96  }
Val val__
Val is the value contained in the box.
Definition: list.h:249

◆ previous()

template<typename Val >
INLINE const ListBucket< Val > * gum::ListBucket< Val >::previous ( ) const
noexcept

Returns the bucket toward the preceding element.

Returns
Returns the bucket toward the preceding element.

Definition at line 124 of file list_tpl.h.

124  {
125  return prev__;
126  }
ListBucket< Val > * prev__
Chaining toward the adjacent elements.
Definition: list.h:244

Friends And Related Function Documentation

◆ List

template<typename Val>
template<typename T , typename A >
friend class List
friend

All the list containers and iterators should be able to access the buckets.

Definition at line 236 of file list.h.

◆ ListConstIterator< Val >

template<typename Val>
friend class ListConstIterator< Val >
friend

Definition at line 238 of file list.h.

◆ ListConstIteratorSafe< Val >

template<typename Val>
friend class ListConstIteratorSafe< Val >
friend

Definition at line 240 of file list.h.

◆ ListIterator< Val >

template<typename Val>
friend class ListIterator< Val >
friend

Definition at line 237 of file list.h.

◆ ListIteratorSafe< Val >

template<typename Val>
friend class ListIteratorSafe< Val >
friend

Definition at line 239 of file list.h.

Member Data Documentation

◆ next__

template<typename Val>
ListBucket< Val >* gum::ListBucket< Val >::next__ {nullptr}
private

Chaining toward the adjacent elements.

Definition at line 245 of file list.h.

◆ prev__

template<typename Val>
ListBucket< Val >* gum::ListBucket< Val >::prev__ {nullptr}
private

Chaining toward the adjacent elements.

Definition at line 244 of file list.h.

◆ val__

template<typename Val>
Val gum::ListBucket< Val >::val__
private

Val is the value contained in the box.

Definition at line 249 of file list.h.


The documentation for this class was generated from the following files: