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

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

#include <Box.hh>

Public Types

typedef std::reference_wrapper< Object const > Reference
 

Public Member Functions

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

Private Attributes

std::vector< Reference_box
 

Detailed Description

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

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

A CBox 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 198 of file Box.hh.

Member Typedef Documentation

◆ Reference

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

Reference the constant reference to an Object

Definition at line 205 of file Box.hh.

Constructor & Destructor Documentation

◆ CBox() [1/3]

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

Default constructor

Definition at line 221 of file Box.hh.

◆ CBox() [2/3]

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

Parametrized constructor

Parameters
objectthe object to refer in this Box

Definition at line 232 of file Box.hh.

◆ CBox() [3/3]

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

Copy constructor

Definition at line 244 of file Box.hh.

Member Function Documentation

◆ clear()

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

Clear the CBox

Definition at line 299 of file Box.hh.

◆ empty()

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

◆ obj()

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

◆ operator<()

template<typename Object>
bool Diades::Utils::CBox< Object >::operator< ( const CBox< 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 315 of file Box.hh.

◆ operator=()

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

Assignment operator

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

Definition at line 287 of file Box.hh.

◆ operator==()

template<typename Object>
bool Diades::Utils::CBox< Object >::operator== ( const CBox< 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 338 of file Box.hh.

Member Data Documentation

◆ _box

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

_box the internal structure that contains the object reference

Definition at line 213 of file Box.hh.


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