aGrUM 3.1.1
a C++ library for (probabilistic) graphical models
gum::ArgMaxSet< GUM_SCALAR_VAL, GUM_SCALAR_SEQ > Struct Template Reference

Class to handle efficiently argMaxSet. More...

#include <agrum/base/multidim/patterns/argMaxSet.h>

Collaboration diagram for gum::ArgMaxSet< GUM_SCALAR_VAL, GUM_SCALAR_SEQ >:

Public Member Functions

Idx size () const
 Gives the size.
const GUM_SCALAR_VAL & value () const
 Returns the value on which comparison are made.
bool exists (const GUM_SCALAR_SEQ &elem) const
CNL
 ArgMaxSet ()
 Constructor.
 ArgMaxSet (const GUM_SCALAR_VAL &val, const GUM_SCALAR_SEQ &elem)
 Constructor.
 ArgMaxSet (const ArgMaxSet< GUM_SCALAR_VAL, GUM_SCALAR_SEQ > &src)
 Copy Constructor.
ArgMaxSet< GUM_SCALAR_VAL, GUM_SCALAR_SEQ > & operator= (const ArgMaxSet< GUM_SCALAR_VAL, GUM_SCALAR_SEQ > &src)
 Constructor.
 ~ArgMaxSet ()
 Destructor.
void * operator new (size_t s)
 Allocators and Deallocators redefinition.
void operator delete (void *p)
 Constructor.
Iterators
SequenceIteratorSafe< GUM_SCALAR_SEQ > beginSafe () const
 Iterator beginning.
SequenceIteratorSafe< GUM_SCALAR_SEQ > endSafe () const
 Iterator end.
Operators
ArgMaxSet< GUM_SCALAR_VAL, GUM_SCALAR_SEQ > & operator+= (const GUM_SCALAR_SEQ &elem)
 Ajout d'un élément.
ArgMaxSet< GUM_SCALAR_VAL, GUM_SCALAR_SEQ > & operator+= (const ArgMaxSet< GUM_SCALAR_VAL, GUM_SCALAR_SEQ > &src)
 Use to insert the content of another set inside this one.
const GUM_SCALAR_SEQ & operator[] (const Idx i) const
 Gives the ith element.
bool operator== (const ArgMaxSet< GUM_SCALAR_VAL, GUM_SCALAR_SEQ > &compared) const
 Compares two ArgMaxSet to check if they are equals.
auto operator<=> (const ArgMaxSet< GUM_SCALAR_VAL, GUM_SCALAR_SEQ > &compared) const
 Ordering comparisons based on val (C++20 spaceship operator).

Private Attributes

Sequence< GUM_SCALAR_SEQ > * _argMaxSeq_
 The very bone of the ArgMaxSet.
GUM_SCALAR_VAL _val_

Friends

std::ostream & operator<< (std::ostream &streamy, const ArgMaxSet &objy)

Detailed Description

template<GUM_Numeric GUM_SCALAR_VAL, GUM_Numeric GUM_SCALAR_SEQ>
struct gum::ArgMaxSet< GUM_SCALAR_VAL, GUM_SCALAR_SEQ >

Class to handle efficiently argMaxSet.

A class containing the set of object assoicated to a maximum.

This set contains the ids of the obj

Definition at line 78 of file argMaxSet.h.

Constructor & Destructor Documentation

◆ ArgMaxSet() [1/3]

template<GUM_Numeric GUM_SCALAR_VAL, GUM_Numeric GUM_SCALAR_SEQ>
gum::ArgMaxSet< GUM_SCALAR_VAL, GUM_SCALAR_SEQ >::ArgMaxSet ( )

Constructor.

Definition at line 62 of file argMaxSet_tpl.h.

62 {
65 }
Class to handle efficiently argMaxSet.
Definition argMaxSet.h:78
ArgMaxSet()
Constructor.
Sequence< GUM_SCALAR_SEQ > * _argMaxSeq_
The very bone of the ArgMaxSet.
Definition argMaxSet.h:181

References ArgMaxSet(), and _argMaxSeq_.

Referenced by ArgMaxSet(), ArgMaxSet(), ArgMaxSet(), ~ArgMaxSet(), operator delete(), operator new(), operator+=(), operator<<, operator<=>(), operator=(), operator==(), and operator[]().

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

◆ ArgMaxSet() [2/3]

template<GUM_Numeric GUM_SCALAR_VAL, GUM_Numeric GUM_SCALAR_SEQ>
gum::ArgMaxSet< GUM_SCALAR_VAL, GUM_SCALAR_SEQ >::ArgMaxSet ( const GUM_SCALAR_VAL & val,
const GUM_SCALAR_SEQ & elem )

Constructor.

Definition at line 71 of file argMaxSet_tpl.h.

72 {
75 _argMaxSeq_->insert(elem);
76 _val_ = val;
77 }
GUM_SCALAR_VAL _val_
Definition argMaxSet.h:182

References ArgMaxSet(), _argMaxSeq_, and _val_.

Here is the call graph for this function:

◆ ArgMaxSet() [3/3]

template<GUM_Numeric GUM_SCALAR_VAL, GUM_Numeric GUM_SCALAR_SEQ>
gum::ArgMaxSet< GUM_SCALAR_VAL, GUM_SCALAR_SEQ >::ArgMaxSet ( const ArgMaxSet< GUM_SCALAR_VAL, GUM_SCALAR_SEQ > & src)

Copy Constructor.

Definition at line 83 of file argMaxSet_tpl.h.

84 {
87 this->operator+=(src);
88 _val_ = src.value();
89 }
const GUM_SCALAR_VAL & value() const
Returns the value on which comparison are made.
ArgMaxSet< GUM_SCALAR_VAL, GUM_SCALAR_SEQ > & operator+=(const GUM_SCALAR_SEQ &elem)
Ajout d'un élément.

References ArgMaxSet(), _argMaxSeq_, _val_, gum::operator+=(), and value().

Here is the call graph for this function:

◆ ~ArgMaxSet()

template<GUM_Numeric GUM_SCALAR_VAL, GUM_Numeric GUM_SCALAR_SEQ>
gum::ArgMaxSet< GUM_SCALAR_VAL, GUM_SCALAR_SEQ >::~ArgMaxSet ( )

Destructor.

Definition at line 105 of file argMaxSet_tpl.h.

105 {
107 delete _argMaxSeq_;
108 }

References ArgMaxSet(), and _argMaxSeq_.

Here is the call graph for this function:

Member Function Documentation

◆ beginSafe()

template<GUM_Numeric GUM_SCALAR_VAL, GUM_Numeric GUM_SCALAR_SEQ>
SequenceIteratorSafe< GUM_SCALAR_SEQ > gum::ArgMaxSet< GUM_SCALAR_VAL, GUM_SCALAR_SEQ >::beginSafe ( ) const

Iterator beginning.

Definition at line 170 of file argMaxSet_tpl.h.

170 {
171 return _argMaxSeq_->beginSafe();
172 }

References _argMaxSeq_.

Referenced by gum::StructuredPlaner< GUM_ELEMENT >::_transferActionIds_(), operator+=(), and operator==().

Here is the caller graph for this function:

◆ endSafe()

template<GUM_Numeric GUM_SCALAR_VAL, GUM_Numeric GUM_SCALAR_SEQ>
SequenceIteratorSafe< GUM_SCALAR_SEQ > gum::ArgMaxSet< GUM_SCALAR_VAL, GUM_SCALAR_SEQ >::endSafe ( ) const

Iterator end.

Definition at line 176 of file argMaxSet_tpl.h.

176 {
177 return _argMaxSeq_->endSafe();
178 }

References _argMaxSeq_.

Referenced by gum::StructuredPlaner< GUM_ELEMENT >::_transferActionIds_(), operator+=(), and operator==().

Here is the caller graph for this function:

◆ exists()

template<GUM_Numeric GUM_SCALAR_VAL, GUM_Numeric GUM_SCALAR_SEQ>
bool gum::ArgMaxSet< GUM_SCALAR_VAL, GUM_SCALAR_SEQ >::exists ( const GUM_SCALAR_SEQ & elem) const

Definition at line 186 of file argMaxSet_tpl.h.

186 {
187 return _argMaxSeq_->exists(elem);
188 }

References _argMaxSeq_.

Referenced by operator==().

Here is the caller graph for this function:

◆ operator delete()

template<GUM_Numeric GUM_SCALAR_VAL, GUM_Numeric GUM_SCALAR_SEQ>
void gum::ArgMaxSet< GUM_SCALAR_VAL, GUM_SCALAR_SEQ >::operator delete ( void * p)

Constructor.

Definition at line 162 of file argMaxSet_tpl.h.

162 {
164 p,
166 }
static SmallObjectAllocator & instance()
void deallocate(void *pDeallocatedObject, const size_t &objectSize)
Deallocates an object.

References ArgMaxSet(), gum::SmallObjectAllocator::deallocate(), and gum::SmallObjectAllocator::instance().

Here is the call graph for this function:

◆ operator new()

template<GUM_Numeric GUM_SCALAR_VAL, GUM_Numeric GUM_SCALAR_SEQ>
void * gum::ArgMaxSet< GUM_SCALAR_VAL, GUM_SCALAR_SEQ >::operator new ( size_t s)

Allocators and Deallocators redefinition.

Definition at line 157 of file argMaxSet_tpl.h.

157 {
159 }
void * allocate(const size_t &objectSize)
Allocates a block.

References ArgMaxSet(), gum::SmallObjectAllocator::allocate(), and gum::SmallObjectAllocator::instance().

Here is the call graph for this function:

◆ operator+=() [1/2]

template<GUM_Numeric GUM_SCALAR_VAL, GUM_Numeric GUM_SCALAR_SEQ>
ArgMaxSet< GUM_SCALAR_VAL, GUM_SCALAR_SEQ > & gum::ArgMaxSet< GUM_SCALAR_VAL, GUM_SCALAR_SEQ >::operator+= ( const ArgMaxSet< GUM_SCALAR_VAL, GUM_SCALAR_SEQ > & src)

Use to insert the content of another set inside this one.

Definition at line 129 of file argMaxSet_tpl.h.

130 {
131 for (auto iter = src.beginSafe(); iter != src.endSafe(); ++iter)
132 if (!_argMaxSeq_->exists(*iter)) _argMaxSeq_->insert(*iter);
133 return *this;
134 }
SequenceIteratorSafe< GUM_SCALAR_SEQ > beginSafe() const
Iterator beginning.
SequenceIteratorSafe< GUM_SCALAR_SEQ > endSafe() const
Iterator end.

References ArgMaxSet(), _argMaxSeq_, beginSafe(), and endSafe().

Here is the call graph for this function:

◆ operator+=() [2/2]

template<GUM_Numeric GUM_SCALAR_VAL, GUM_Numeric GUM_SCALAR_SEQ>
ArgMaxSet< GUM_SCALAR_VAL, GUM_SCALAR_SEQ > & gum::ArgMaxSet< GUM_SCALAR_VAL, GUM_SCALAR_SEQ >::operator+= ( const GUM_SCALAR_SEQ & elem)

Ajout d'un élément.

Definition at line 119 of file argMaxSet_tpl.h.

119 {
120 _argMaxSeq_->insert(elem);
121 return *this;
122 }

References _argMaxSeq_.

◆ operator<=>()

template<GUM_Numeric GUM_SCALAR_VAL, GUM_Numeric GUM_SCALAR_SEQ>
auto gum::ArgMaxSet< GUM_SCALAR_VAL, GUM_SCALAR_SEQ >::operator<=> ( const ArgMaxSet< GUM_SCALAR_VAL, GUM_SCALAR_SEQ > & compared) const

Ordering comparisons based on val (C++20 spaceship operator).

Definition at line 151 of file argMaxSet_tpl.h.

151 =>(
153 return _val_ <=> compared.value();
154 }

References ArgMaxSet(), and value().

Here is the call graph for this function:

◆ operator=()

template<GUM_Numeric GUM_SCALAR_VAL, GUM_Numeric GUM_SCALAR_SEQ>
ArgMaxSet< GUM_SCALAR_VAL, GUM_SCALAR_SEQ > & gum::ArgMaxSet< GUM_SCALAR_VAL, GUM_SCALAR_SEQ >::operator= ( const ArgMaxSet< GUM_SCALAR_VAL, GUM_SCALAR_SEQ > & src)

Constructor.

Definition at line 93 of file argMaxSet_tpl.h.

94 {
95 this->_argMaxSeq_->clear();
96 this->operator+=(src);
97 _val_ = src.value();
98 return *this;
99 }

References ArgMaxSet(), _argMaxSeq_, _val_, gum::operator+=(), and value().

Here is the call graph for this function:

◆ operator==()

template<GUM_Numeric GUM_SCALAR_VAL, GUM_Numeric GUM_SCALAR_SEQ>
bool gum::ArgMaxSet< GUM_SCALAR_VAL, GUM_SCALAR_SEQ >::operator== ( const ArgMaxSet< GUM_SCALAR_VAL, GUM_SCALAR_SEQ > & compared) const

Compares two ArgMaxSet to check if they are equals.

Definition at line 140 of file argMaxSet_tpl.h.

141 {
142 if (_val_ != compared.value()) return false;
143 for (auto iter = compared.beginSafe(); iter != compared.endSafe(); ++iter)
144 if (!_argMaxSeq_->exists(*iter)) return false;
145 for (auto iter = this->beginSafe(); iter != this->endSafe(); ++iter)
146 if (!compared.exists(*iter)) return false;
147 return true;
148 }
bool exists(const GUM_SCALAR_SEQ &elem) const

References ArgMaxSet(), _argMaxSeq_, _val_, beginSafe(), endSafe(), exists(), and value().

Here is the call graph for this function:

◆ operator[]()

template<GUM_Numeric GUM_SCALAR_VAL, GUM_Numeric GUM_SCALAR_SEQ>
const GUM_SCALAR_SEQ & gum::ArgMaxSet< GUM_SCALAR_VAL, GUM_SCALAR_SEQ >::operator[] ( const Idx i) const

Gives the ith element.

References ArgMaxSet().

Here is the call graph for this function:

◆ size()

template<GUM_Numeric GUM_SCALAR_VAL, GUM_Numeric GUM_SCALAR_SEQ>
Idx gum::ArgMaxSet< GUM_SCALAR_VAL, GUM_SCALAR_SEQ >::size ( ) const

Gives the size.

Definition at line 191 of file argMaxSet_tpl.h.

191 {
192 return _argMaxSeq_->size();
193 }

References _argMaxSeq_.

◆ value()

template<GUM_Numeric GUM_SCALAR_VAL, GUM_Numeric GUM_SCALAR_SEQ>
const GUM_SCALAR_VAL & gum::ArgMaxSet< GUM_SCALAR_VAL, GUM_SCALAR_SEQ >::value ( ) const

Returns the value on which comparison are made.

Definition at line 181 of file argMaxSet_tpl.h.

181 {
182 return _val_;
183 }

References _val_.

Referenced by ArgMaxSet(), operator<<, operator<=>(), operator=(), and operator==().

Here is the caller graph for this function:

◆ operator<<

template<GUM_Numeric GUM_SCALAR_VAL, GUM_Numeric GUM_SCALAR_SEQ>
std::ostream & operator<< ( std::ostream & streamy,
const ArgMaxSet< GUM_SCALAR_VAL, GUM_SCALAR_SEQ > & objy )
friend

Member Data Documentation

◆ _argMaxSeq_

template<GUM_Numeric GUM_SCALAR_VAL, GUM_Numeric GUM_SCALAR_SEQ>
Sequence< GUM_SCALAR_SEQ >* gum::ArgMaxSet< GUM_SCALAR_VAL, GUM_SCALAR_SEQ >::_argMaxSeq_
private

◆ _val_

template<GUM_Numeric GUM_SCALAR_VAL, GUM_Numeric GUM_SCALAR_SEQ>
GUM_SCALAR_VAL gum::ArgMaxSet< GUM_SCALAR_VAL, GUM_SCALAR_SEQ >::_val_
private

Definition at line 182 of file argMaxSet.h.

Referenced by ArgMaxSet(), ArgMaxSet(), operator=(), operator==(), and value().


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