DiaDes  0.1
DIAgnosis of Discrete-Event System
Public Types | Public Member Functions | Private Attributes | List of all members
Diades::Utils::Box< Object > Class Template Reference

A Box is a container that contains at most a reference to an object. More...

#include <Box.hh>

Public Types

typedef std::reference_wrapper< Object > Reference
 

Public Member Functions

 Box ()
 
 Box (Object &object)
 
 Box (Box &box)
 
Object & obj ()
 
const Object & cObj () const
 
bool empty () const
 
Object & operator= (Object &object)
 
bool operator< (const Box &box) const
 
bool operator== (const Box &box) const
 
void clear ()
 

Private Attributes

std::vector< Reference_box
 

Detailed Description

template<typename Object>
class Diades::Utils::Box< Object >

A Box is a container that contains at most a reference to an object.

A Box is a small utility based on a vector and a reference_wrapper that helps at holding a reference either permanently or temporarily

Definition at line 27 of file Box.hh.

Member Typedef Documentation

◆ Reference

template<typename Object>
typedef std::reference_wrapper<Object> Diades::Utils::Box< Object >::Reference

Reference the reference to an Object

Definition at line 34 of file Box.hh.

Constructor & Destructor Documentation

◆ Box() [1/3]

template<typename Object>
Diades::Utils::Box< Object >::Box ( )
inline

Default constructor

Definition at line 50 of file Box.hh.

◆ Box() [2/3]

template<typename Object>
Diades::Utils::Box< Object >::Box ( Object &  object)
inline

Parametrized constructor

Parameters
objectthe object to refer in this Box

Definition at line 61 of file Box.hh.

◆ Box() [3/3]

template<typename Object>
Diades::Utils::Box< Object >::Box ( Box< Object > &  box)
inline

Copy constructor

Definition at line 73 of file Box.hh.

Member Function Documentation

◆ clear()

template<typename Object>
void Diades::Utils::Box< Object >::clear ( )
inline

Clear the Box

Definition at line 177 of file Box.hh.

◆ cObj()

template<typename Object>
const Object& Diades::Utils::Box< Object >::cObj ( ) const
inline

◆ empty()

template<typename Object>
bool Diades::Utils::Box< Object >::empty ( ) const
inline

◆ obj()

template<typename Object>
Object& Diades::Utils::Box< Object >::obj ( )
inline

◆ operator<()

template<typename Object>
bool Diades::Utils::Box< Object >::operator< ( const Box< Object > &  box) const
inline

Comparison operator

Parameters
box
Returns
true if the object referenced by the current box is lower than the one in the second box. An empty box is lower than a non empty box

Definition at line 144 of file Box.hh.

◆ operator=()

template<typename Object>
Object& Diades::Utils::Box< Object >::operator= ( Object &  object)
inline

Assignment operator

Parameters
objectthe object to be referred by the Box
Returns
the object

Definition at line 127 of file Box.hh.

◆ operator==()

template<typename Object>
bool Diades::Utils::Box< Object >::operator== ( const Box< Object > &  box) const
inline

Equality operator

Parameters
box
Returns
true if the boxes refer to two objects that are equal (that is obj() == obj()) or if both boxes are empty

Definition at line 167 of file Box.hh.

Member Data Documentation

◆ _box

template<typename Object>
std::vector<Reference> Diades::Utils::Box< Object >::_box
private

_box the internal structure that contains the object reference

Definition at line 42 of file Box.hh.


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