aGrUM  0.20.3
a C++ library for (probabilistic) graphical models
gum::ActionSet Class Reference

A class to store the optimal actions. More...

#include <agrum/FMDP/planning/actionSet.h>

+ Collaboration diagram for gum::ActionSet:

Public Member Functions

Size size () const
 Gives the size. More...
 
bool exists (const Idx &elem) const
 
CNL
 ActionSet ()
 Constructor. More...
 
 ActionSet (const ActionSet &src)
 Constructor. More...
 
ActionSetoperator= (const ActionSet &src)
 Constructor. More...
 
 ~ActionSet ()
 Destructor. More...
 
void * operator new (size_t s)
 Allocators and Deallocators redefinition. More...
 
void operator delete (void *p)
 Constructor. More...
 
Iterators
SequenceIteratorSafe< IdxbeginSafe () const
 Iterator beginning. More...
 
SequenceIteratorSafe< IdxendSafe () const
 Iterator end. More...
 
Operators
ActionSetoperator+= (const Idx &elem)
 Ajout d'un élément. More...
 
ActionSetoperator+= (const ActionSet &src)
 Use to insert the content of another set inside this one. More...
 
ActionSetoperator-= (const ActionSet &src)
 Use to insert the content of another set inside this one. More...
 
const Idxoperator[] (const Idx i) const
 Gives the ith element. More...
 
bool operator== (const ActionSet &compared) const
 Compares two ActionSet to check if they are equals. More...
 
bool operator!= (const ActionSet &compared) const
 Ajout d'un élément. More...
 

Friends

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

Detailed Description

A class to store the optimal actions.

Stores the ids of optimal actions. To be used as leaves on optimal policy tree or function graph

Definition at line 88 of file actionSet.h.

Constructor & Destructor Documentation

◆ ActionSet() [1/2]

gum::ActionSet::ActionSet ( )
inline

Constructor.

Definition at line 98 of file actionSet.h.

98  {
99  GUM_CONSTRUCTOR(ActionSet);
101  }
ActionSet()
Constructor.
Definition: actionSet.h:98
Sequence< Idx > * _actionSeq_
The very bone of the ActionSet.
Definition: actionSet.h:211

◆ ActionSet() [2/2]

gum::ActionSet::ActionSet ( const ActionSet src)
inline

Constructor.

Definition at line 103 of file actionSet.h.

103  {
104  GUM_CONSTRUCTOR(ActionSet);
106  for (auto idi = src.beginSafe(); idi != src.endSafe(); ++idi)
107  _actionSeq_->insert(*idi);
108  }
ActionSet()
Constructor.
Definition: actionSet.h:98
Sequence< Idx > * _actionSeq_
The very bone of the ActionSet.
Definition: actionSet.h:211
void insert(const Key &k)
Insert an element at the end of the sequence.
Definition: sequence_tpl.h:393

◆ ~ActionSet()

gum::ActionSet::~ActionSet ( )
inline

Destructor.

Definition at line 120 of file actionSet.h.

120  {
121  GUM_DESTRUCTOR(ActionSet);
122  delete _actionSeq_;
123  }
ActionSet()
Constructor.
Definition: actionSet.h:98
Sequence< Idx > * _actionSeq_
The very bone of the ActionSet.
Definition: actionSet.h:211

Member Function Documentation

◆ beginSafe()

SequenceIteratorSafe< Idx > gum::ActionSet::beginSafe ( ) const
inline

Iterator beginning.

Definition at line 143 of file actionSet.h.

143 { return _actionSeq_->beginSafe(); }
iterator_safe beginSafe() const
Returns a safe begin iterator.
Definition: sequence_tpl.h:603
Sequence< Idx > * _actionSeq_
The very bone of the ActionSet.
Definition: actionSet.h:211

◆ endSafe()

SequenceIteratorSafe< Idx > gum::ActionSet::endSafe ( ) const
inline

Iterator end.

Definition at line 148 of file actionSet.h.

148 { return _actionSeq_->endSafe(); }
const iterator_safe & endSafe() const noexcept
Returns the safe end iterator.
Definition: sequence_tpl.h:610
Sequence< Idx > * _actionSeq_
The very bone of the ActionSet.
Definition: actionSet.h:211

◆ exists()

bool gum::ActionSet::exists ( const Idx elem) const
inline

Definition at line 207 of file actionSet.h.

207 { return _actionSeq_->exists(elem); }
bool exists(const Key &k) const
Check the existence of k in the sequence.
Definition: sequence_tpl.h:387
Sequence< Idx > * _actionSeq_
The very bone of the ActionSet.
Definition: actionSet.h:211

◆ operator delete()

void gum::ActionSet::operator delete ( void *  p)
inline

Constructor.

Definition at line 129 of file actionSet.h.

129  {
131  }
ActionSet()
Constructor.
Definition: actionSet.h:98
void deallocate(void *pDeallocatedObject, const size_t &objectSize)
Deallocates an object.
static SmallObjectAllocator & instance()

◆ operator new()

void* gum::ActionSet::operator new ( size_t  s)
inline

Allocators and Deallocators redefinition.

Definition at line 128 of file actionSet.h.

void * allocate(const size_t &objectSize)
Allocates a block.
static SmallObjectAllocator & instance()

◆ operator!=()

bool gum::ActionSet::operator!= ( const ActionSet compared) const
inline

Ajout d'un élément.

Definition at line 198 of file actionSet.h.

References operator==().

198 { return !(*this == compared); }
+ Here is the call graph for this function:

◆ operator+=() [1/2]

ActionSet& gum::ActionSet::operator+= ( const Idx elem)
inline

Ajout d'un élément.

Definition at line 160 of file actionSet.h.

160  {
161  _actionSeq_->insert(elem);
162  return *this;
163  }
Sequence< Idx > * _actionSeq_
The very bone of the ActionSet.
Definition: actionSet.h:211
void insert(const Key &k)
Insert an element at the end of the sequence.
Definition: sequence_tpl.h:393

◆ operator+=() [2/2]

ActionSet& gum::ActionSet::operator+= ( const ActionSet src)
inline

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

Definition at line 168 of file actionSet.h.

168  {
169  for (auto iter = src.beginSafe(); iter != src.endSafe(); ++iter)
170  if (!_actionSeq_->exists(*iter)) _actionSeq_->insert(*iter);
171  return *this;
172  }
bool exists(const Key &k) const
Check the existence of k in the sequence.
Definition: sequence_tpl.h:387
Sequence< Idx > * _actionSeq_
The very bone of the ActionSet.
Definition: actionSet.h:211
void insert(const Key &k)
Insert an element at the end of the sequence.
Definition: sequence_tpl.h:393

◆ operator-=()

ActionSet& gum::ActionSet::operator-= ( const ActionSet src)
inline

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

Definition at line 177 of file actionSet.h.

177  {
178  for (auto iter = src.beginSafe(); iter != src.endSafe(); ++iter)
179  if (_actionSeq_->exists(*iter)) _actionSeq_->erase(*iter);
180  return *this;
181  }
bool exists(const Key &k) const
Check the existence of k in the sequence.
Definition: sequence_tpl.h:387
Sequence< Idx > * _actionSeq_
The very bone of the ActionSet.
Definition: actionSet.h:211
void erase(const Key &k)
Remove an element from the sequence.
Definition: sequence_tpl.h:437

◆ operator=()

ActionSet& gum::ActionSet::operator= ( const ActionSet src)
inline

Constructor.

Definition at line 110 of file actionSet.h.

110  {
112  for (auto idi = src.beginSafe(); idi != src.endSafe(); ++idi)
113  _actionSeq_->insert(*idi);
114  return *this;
115  }
Sequence< Idx > * _actionSeq_
The very bone of the ActionSet.
Definition: actionSet.h:211
void insert(const Key &k)
Insert an element at the end of the sequence.
Definition: sequence_tpl.h:393

◆ operator==()

bool gum::ActionSet::operator== ( const ActionSet compared) const
inline

Compares two ActionSet to check if they are equals.

Definition at line 191 of file actionSet.h.

Referenced by operator!=().

191  {
192  for (auto iter = compared.beginSafe(); iter != compared.endSafe(); ++iter)
193  if (!_actionSeq_->exists(*iter)) return false;
194  for (auto iter = this->beginSafe(); iter != this->endSafe(); ++iter)
195  if (!compared.exists(*iter)) return false;
196  return true;
197  }
SequenceIteratorSafe< Idx > endSafe() const
Iterator end.
Definition: actionSet.h:148
bool exists(const Key &k) const
Check the existence of k in the sequence.
Definition: sequence_tpl.h:387
SequenceIteratorSafe< Idx > beginSafe() const
Iterator beginning.
Definition: actionSet.h:143
Sequence< Idx > * _actionSeq_
The very bone of the ActionSet.
Definition: actionSet.h:211
+ Here is the caller graph for this function:

◆ operator[]()

const Idx& gum::ActionSet::operator[] ( const Idx  i) const
inline

Gives the ith element.

Definition at line 186 of file actionSet.h.

186 { return _actionSeq_->atPos(i); }
Sequence< Idx > * _actionSeq_
The very bone of the ActionSet.
Definition: actionSet.h:211
const Key & atPos(Idx i) const
Returns the object at the pos i.
Definition: sequence_tpl.h:483

◆ size()

Size gum::ActionSet::size ( ) const
inline

Gives the size.

Definition at line 205 of file actionSet.h.

205 { return _actionSeq_->size(); }
Size size() const noexcept
Returns the size of the sequence.
Definition: sequence_tpl.h:37
Sequence< Idx > * _actionSeq_
The very bone of the ActionSet.
Definition: actionSet.h:211

Friends And Related Function Documentation

◆ operator<<

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

Definition at line 213 of file actionSet.h.

213  {
214  streamy << objy._actionSeq_->toString();
215  return streamy;
216  }

Member Data Documentation

◆ _actionSeq_

Sequence< Idx >* gum::ActionSet::_actionSeq_
private

The very bone of the ActionSet.

Definition at line 211 of file actionSet.h.


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