aGrUM 3.1.1
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>
 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 113 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 120 of file list.h.

120{ 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>
gum::ListBucket< Val >::ListBucket ( const Val & v)
explicit

Default constructor.

Parameters
vThe value stored in the gum::ListBucket.

Definition at line 64 of file list_tpl.h.

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

References ListBucket(), and _val_.

Here is the call graph for this function:

◆ ListBucket() [3/7]

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

Constructor for Val rvalues.

Parameters
vThe value stored in the gum::ListBucket.

Definition at line 71 of file list_tpl.h.

71 : _val_{std::move(v)} {
72 // for debugging purposes
74 }

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>
gum::ListBucket< Val >::ListBucket ( const ListBucket< Val > & src)

Copy constructor.

Parameters
srcThe gum::ListBucket to copy.

Definition at line 87 of file list_tpl.h.

87 : _val_{src._val_} {
88 // for debugging purposes
90 }

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

106 {
107 // for debugging purposes
109 }

References ListBucket().

Here is the call graph for this function:

◆ ListBucket() [7/7]

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

Definition at line 79 of file list_tpl.h.

79 :
81 // for debugging purposes
83 }

Member Function Documentation

◆ next()

template<typename Val>
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 137 of file list_tpl.h.

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

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

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

References ListBucket(), and _val_.

Here is the call graph for this function:

◆ operator*() [1/2]

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

Dereferencing operator.

Returns
The value stored in this gum::ListBucket.

Definition at line 125 of file list_tpl.h.

125 {
126 return _val_;
127 }

References _val_.

◆ operator*() [2/2]

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

Dereferencing operator.

Returns
The value stored in this gum::ListBucket.

Definition at line 131 of file list_tpl.h.

131 {
132 return _val_;
133 }

References _val_.

◆ operator=() [1/2]

template<typename Val>
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 94 of file list_tpl.h.

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

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

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

References ListBucket(), and _val_.

Here is the call graph for this function:

◆ previous()

template<typename Val>
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 143 of file list_tpl.h.

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

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 236 of file list.h.

References ListBucket(), and previous().

◆ ListConstIterator< Val >

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

Definition at line 236 of file list.h.

◆ ListConstIteratorSafe< Val >

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

Definition at line 236 of file list.h.

◆ ListIterator< Val >

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

Definition at line 236 of file list.h.

◆ ListIteratorSafe< Val >

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

Definition at line 236 of file list.h.

Member Data Documentation

◆ _next_

◆ _prev_

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

◆ _val_


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