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

Bucket for a chained list. More...

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

Public Member Functions

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

Private Types

enum class  Emplace { EMPLACE }
 C dummy type for the emplace constructor. More...

Private Attributes

Val _val_
 Val is the value contained in the box.
ListBucket< Val > * _prev_ {nullptr}
 Chaining toward the adjacent elements.
ListBucket< Val > * _next_ {nullptr}
 Chaining toward the adjacent elements.

Friends

class List< Val >
 All the list containers and iterators should be able to access the buckets.
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 114 of file list.h.

Member Enumeration Documentation

◆ Emplace

template<typename Val>
enum class 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 121 of file list.h.

121{ EMPLACE };

Constructor & Destructor Documentation

◆ ListBucket() [1/7]

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

Removes empty constructor.

Referenced by ListBucket(), ListBucket(), ListBucket(), ListBucket(), ~ListBucket(), List< Val >, next(), operator!=(), operator=(), operator=(), operator==(), and previous().

Here is the caller graph for this function:

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

63 : _val_{v} {
64 // for debugging purposes
66 }
Bucket for a chained list.
Definition list.h:114
Val _val_
Val is the value contained in the box.
Definition list.h:257
ListBucket()=delete
Removes empty constructor.

References ListBucket(), and _val_.

Here is the call graph for this function:

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

70 : _val_{std::move(v)} {
71 // for debugging purposes
73 }

References _val_.

◆ 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.

References ListBucket().

Here is the call graph for this function:

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

86 : _val_{src._val_} {
87 // for debugging purposes
89 }

References ListBucket(), and _val_.

Here is the call graph for this function:

◆ 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.

References ListBucket().

Here is the call graph for this function:

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

105 {
106 // for debugging purposes
108 }

References ListBucket().

Here is the call graph for this function:

◆ ListBucket() [7/7]

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

Definition at line 78 of file list_tpl.h.

78 :
80 // for debugging purposes
82 }

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

136 {
137 return _next_;
138 }
ListBucket< Val > * _next_
Chaining toward the adjacent elements.
Definition list.h:253

References ListBucket(), and _next_.

Referenced by operator=().

Here is the call graph for this function:
Here is the caller graph for this function:

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

118 {
119 return (src._val_ != _val_);
120 }

References ListBucket(), and _val_.

Here is the call graph for this function:

◆ operator*() [1/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 124 of file list_tpl.h.

124 {
125 return _val_;
126 }

References _val_.

◆ operator*() [2/2]

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

Dereferencing operator.

Returns
The value stored in this gum::ListBucket.

Definition at line 130 of file list_tpl.h.

130 {
131 return _val_;
132 }

References _val_.

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

93 {
94 // for debugging purposes
96
97 // no need to avoid self assignment
98 _val_ = src._val_;
99 return *this;
100 }

References ListBucket(), and _val_.

Here is the call graph for this function:

◆ 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.

References ListBucket(), and next().

Here is the call graph for this function:

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

112 {
113 return (src._val_ == _val_);
114 }

References ListBucket(), and _val_.

Here is the call graph for this function:

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

142 {
143 return _prev_;
144 }
ListBucket< Val > * _prev_
Chaining toward the adjacent elements.
Definition list.h:252

References ListBucket(), and _prev_.

Referenced by List< Val >.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ List< Val >

template<typename Val>
friend class List< Val >
friend

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

Definition at line 237 of file list.h.

References ListBucket(), and previous().

◆ ListConstIterator< Val >

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

Definition at line 237 of file list.h.

◆ ListConstIteratorSafe< Val >

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

Definition at line 237 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 237 of file list.h.

Member Data Documentation

◆ _next_

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

◆ _prev_

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

◆ _val_


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