CARMA C++
carma::monitor::MonitorPointIterator Class Reference

Iterator for monitor point hierarchy that returns monitor points. More...

#include <carma/monitor/MonitorPointIterator.h>

Public Member Functions

void checkStats (bool throwOnProblem) const
 
MonitorPointgetMonitorPoint () const
 Get the current monitor point. More...
 
bool hasMonitorPoint () const
 Test for monitor points in current state of iterator. More...
 
 MonitorPointIterator (const MonitorContainer &rootContainer, int maxDepth=0, const std::vector< std::string > skip=std::vector< std::string >())
 Constructor. More...
 
bool operator++ ()
 Iterator (prefix version) More...
 
bool operator++ (int dummy)
 Iterator (postfix version) More...
 
void reset ()
 Reset iterator back to beginning. More...
 

Detailed Description

Iterator for monitor point hierarchy that returns monitor points.

The iterator is given a component in the tree and can return all monitor points below that component. If it is given a MonitorPoint component then it will return that monitor point. There is also a parameter (maxLevels) available to limit the number of levels to descend. This is handy if you just want to get all the monitor points in a container and not descend into sub-containers (set maxLevels=1).

Usage example:
 MonitorPointIterator itr(hierarchy);
 while(itr++) {
   MonitorPoint& mp = itr.getMonitorPoint();
     do something with mp...
 }
 

Definition at line 51 of file MonitorPointIterator.h.

Constructor & Destructor Documentation

carma::monitor::MonitorPointIterator::MonitorPointIterator ( const MonitorContainer rootContainer,
int  maxDepth = 0,
const std::vector< std::string >  skip = std::vector< std::string >() 
)
explicit

Constructor.

Parameters
rootContainerMonitorContainer that is the root of the hierarchy
maxDepththe maximum number of levels to descend it the hierarchy. The default value of zero means go all the way down, a value of one will just get the monitor points in this container.
skipSubcontainers to skip (includes all children).
Todo:
Add support for regular expressions to specify skips.

Member Function Documentation

carma::monitor::MonitorPoint & carma::monitor::MonitorPointIterator::getMonitorPoint ( ) const

Get the current monitor point.

Returns
monitorPoint reference

Definition at line 154 of file MonitorPointIterator.h.

bool carma::monitor::MonitorPointIterator::hasMonitorPoint ( ) const

Test for monitor points in current state of iterator.

Returns
false if there are no more more points or if the iterator has just been constructed If there are more points, they can be retrieved with
See Also
getMonitorPoint

Definition at line 147 of file MonitorPointIterator.h.

bool carma::monitor::MonitorPointIterator::operator++ ( )

Iterator (prefix version)

Returns
true if another monitor point is gotten
See Also
getMonitorPoint
bool carma::monitor::MonitorPointIterator::operator++ ( int  dummy)

Iterator (postfix version)

Parameters
dummyto distinguish postfix from prefix version
Returns
true if another monitor point is gotten
See Also
getMonitorPoint

Definition at line 140 of file MonitorPointIterator.h.

void carma::monitor::MonitorPointIterator::reset ( )

Reset iterator back to beginning.


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