torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
torc::generic::StatusContainer Class Reference

Represents objects that have status. More...

#include <StatusContainer.hpp>

+ Inheritance diagram for torc::generic::StatusContainer:

Public Member Functions

void getStatuses (std::vector< StatusSharedPtr > &outStatus) const
 
void setStatuses (const std::vector< StatusSharedPtr > &inStatus)
 
void addStatus (const StatusSharedPtr &inStatus) throw (Error)
 
template<typename _Action >
void applyOnAllStatuses (const _Action &action) throw (Error)
 
 ~StatusContainer () throw ()
 

Protected Member Functions

 StatusContainer ()
 

Private Member Functions

 StatusContainer (const StatusContainer &source)
 
StatusContaineroperator= (const StatusContainer &source)
 

Private Attributes

std::vector< StatusSharedPtrmStatuses
 

Detailed Description

Represents objects that have status.

The StatusContainer interface is generalized by classes that need to hold status.

Definition at line 35 of file StatusContainer.hpp.

Constructor & Destructor Documentation

torc::generic::StatusContainer::~StatusContainer ( )
throw (
)

Definition at line 25 of file StatusContainer.cpp.

25 {}
torc::generic::StatusContainer::StatusContainer ( )
protected

Definition at line 22 of file StatusContainer.cpp.

22  :
23  mStatuses() {}
std::vector< StatusSharedPtr > mStatuses
torc::generic::StatusContainer::StatusContainer ( const StatusContainer source)
private

Member Function Documentation

void torc::generic::StatusContainer::addStatus ( const StatusSharedPtr inStatus)
throw (Error
)

Add a status to the vector of statuses. If an empty pointer is supplied, it returns without doing anything.

Parameters
[in]inStatusA pointer to a status object.
Exceptions
ErrorStatus could not be added.

Add a status to the list of statuses. If an empty pointer is supplied, it returns without doing anything.

Parameters
[in]inStatusA pointer to a status object.
Exceptions
ErrorStatus could not be added.

Definition at line 47 of file StatusContainer.cpp.

47  {
48  mStatuses.push_back(inStatus);
49 }
std::vector< StatusSharedPtr > mStatuses
template<typename _Action >
void torc::generic::StatusContainer::applyOnAllStatuses ( const _Action &  action)
throw (Error
)
inline

Apply action on all statuses.

Parameters
[in]actionAction to be applied

Definition at line 95 of file StatusContainer.hpp.

96  {
97  try {
98  std::vector<StatusSharedPtr>::iterator it = mStatuses.begin();
99  for(; it != mStatuses.end(); ++it) {
100  action(*it);
101  }
102  } catch(Error& e) {
103  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
104  throw;
105  }
106 }
std::vector< StatusSharedPtr > mStatuses

+ Here is the call graph for this function:

void torc::generic::StatusContainer::getStatuses ( std::vector< StatusSharedPtr > &  outStatus) const
inline

Get a vector of pointer to Status object

Parameters
[out]outStatusThe vector of pointer to Status object

Definition at line 86 of file StatusContainer.hpp.

86  {
87  outStatus.insert(outStatus.end(), mStatuses.begin(), mStatuses.end());
88 }
std::vector< StatusSharedPtr > mStatuses
StatusContainer& torc::generic::StatusContainer::operator= ( const StatusContainer source)
private
void torc::generic::StatusContainer::setStatuses ( const std::vector< StatusSharedPtr > &  inStatus)

Set a vector of pointer to Status object

Parameters
[in]inStatusThe vector of pointer to Status object

Definition at line 32 of file StatusContainer.cpp.

32  {
33  std::vector<StatusSharedPtr>::const_iterator it = inStatus.begin();
34  for(; it != inStatus.end(); it++) {
35  mStatuses.push_back(*it);
36  }
37 }
std::vector< StatusSharedPtr > mStatuses

Field Documentation

std::vector<StatusSharedPtr> torc::generic::StatusContainer::mStatuses
private

Definition at line 78 of file StatusContainer.hpp.


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