aGrUM  0.20.2
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  }
Sequence< Idx > * actionSeq__
The very bone of the ActionSet.
Definition: actionSet.h:217
ActionSet()
Constructor.
Definition: actionSet.h:98

◆ 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  }
Sequence< Idx > * actionSeq__
The very bone of the ActionSet.
Definition: actionSet.h:217
ActionSet()
Constructor.
Definition: actionSet.h:98
void insert(const Key &k)
Insert an element at the end of the sequence.
Definition: sequence_tpl.h:409

◆ ~ActionSet()

gum::ActionSet::~ActionSet ( )
inline

Destructor.

Definition at line 120 of file actionSet.h.

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

Member Function Documentation

◆ beginSafe()

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

Iterator beginning.

Definition at line 145 of file actionSet.h.

145  {
146  return actionSeq__->beginSafe();
147  }
Sequence< Idx > * actionSeq__
The very bone of the ActionSet.
Definition: actionSet.h:217
iterator_safe beginSafe() const
Returns a safe begin iterator.
Definition: sequence_tpl.h:628

◆ endSafe()

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

Iterator end.

Definition at line 152 of file actionSet.h.

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

◆ exists()

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

Definition at line 213 of file actionSet.h.

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

◆ operator delete()

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

Constructor.

Definition at line 131 of file actionSet.h.

131  {
133  }
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.

128  {
130  }
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 202 of file actionSet.h.

References operator==().

202  {
203  return !(*this == compared);
204  }
+ 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 164 of file actionSet.h.

164  {
165  actionSeq__->insert(elem);
166  return *this;
167  }
Sequence< Idx > * actionSeq__
The very bone of the ActionSet.
Definition: actionSet.h:217
void insert(const Key &k)
Insert an element at the end of the sequence.
Definition: sequence_tpl.h:409

◆ 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 172 of file actionSet.h.

172  {
173  for (auto iter = src.beginSafe(); iter != src.endSafe(); ++iter)
174  if (!actionSeq__->exists(*iter)) actionSeq__->insert(*iter);
175  return *this;
176  }
Sequence< Idx > * actionSeq__
The very bone of the ActionSet.
Definition: actionSet.h:217
bool exists(const Key &k) const
Check the existence of k in the sequence.
Definition: sequence_tpl.h:403
void insert(const Key &k)
Insert an element at the end of the sequence.
Definition: sequence_tpl.h:409

◆ operator-=()

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

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

Definition at line 181 of file actionSet.h.

181  {
182  for (auto iter = src.beginSafe(); iter != src.endSafe(); ++iter)
183  if (actionSeq__->exists(*iter)) actionSeq__->erase(*iter);
184  return *this;
185  }
Sequence< Idx > * actionSeq__
The very bone of the ActionSet.
Definition: actionSet.h:217
bool exists(const Key &k) const
Check the existence of k in the sequence.
Definition: sequence_tpl.h:403
void erase(const Key &k)
Remove an element from the sequence.
Definition: sequence_tpl.h:454

◆ 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:217
void insert(const Key &k)
Insert an element at the end of the sequence.
Definition: sequence_tpl.h:409

◆ operator==()

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

Compares two ActionSet to check if they are equals.

Definition at line 195 of file actionSet.h.

Referenced by operator!=().

195  {
196  for (auto iter = compared.beginSafe(); iter != compared.endSafe(); ++iter)
197  if (!actionSeq__->exists(*iter)) return false;
198  for (auto iter = this->beginSafe(); iter != this->endSafe(); ++iter)
199  if (!compared.exists(*iter)) return false;
200  return true;
201  }
Sequence< Idx > * actionSeq__
The very bone of the ActionSet.
Definition: actionSet.h:217
SequenceIteratorSafe< Idx > endSafe() const
Iterator end.
Definition: actionSet.h:152
bool exists(const Key &k) const
Check the existence of k in the sequence.
Definition: sequence_tpl.h:403
SequenceIteratorSafe< Idx > beginSafe() const
Iterator beginning.
Definition: actionSet.h:145
+ 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 190 of file actionSet.h.

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

◆ size()

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

Gives the size.

Definition at line 211 of file actionSet.h.

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

Friends And Related Function Documentation

◆ operator<<

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

Definition at line 219 of file actionSet.h.

219  {
220  streamy << objy.actionSeq__->toString();
221  return streamy;
222  }

Member Data Documentation

◆ actionSeq__

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

The very bone of the ActionSet.

Definition at line 217 of file actionSet.h.


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