aGrUM  0.20.3
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  }
ListBucket()=delete
Removes empty constructor.
Val _val_
Val is the value contained in the box.
Definition: list.h:249

◆ 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  }
ListBucket()=delete
Removes empty constructor.
Val _val_
Val is the value contained in the box.
Definition: list.h:249

◆ 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 65 of file list_tpl.h.

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

◆ 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 84 of file list_tpl.h.

84  {
85  // for debugging purposes
86  GUM_DESTRUCTOR(ListBucket);
87  }
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.

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

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 115 of file list_tpl.h.

115  {
116  return _next_;
117  }
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 97 of file list_tpl.h.

97  {
98  return (src._val_ != _val_);
99  }
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 109 of file list_tpl.h.

109  {
110  return _val_;
111  }
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 103 of file list_tpl.h.

103  {
104  return _val_;
105  }
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 72 of file list_tpl.h.

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

◆ 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 91 of file list_tpl.h.

91  {
92  return (src._val_ == _val_);
93  }
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 121 of file list_tpl.h.

121  {
122  return _prev_;
123  }
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: