1 #ifndef CARMA_MONITOR_MONITORCONTAINER_H
2 #define CARMA_MONITOR_MONITORCONTAINER_H
30 class MonitorSubsystem;
72 bool isContainer( )
const;
88 static const unsigned char kMpBitMask = 1;
89 static const unsigned char kContainerBitMask = 2;
90 static const unsigned char kSubsystemBitMask = 4;
105 const Child &
getChild(
int index )
const;
146 bool caseSensitive )
const;
154 bool caseSensitive )
const;
157 getMonitorPointPtr(
const std::string & name,
158 bool caseSensitive )
const;
166 MonitorPoint * getMonitorPointPtr( tagIDType tagID )
const;
211 bool onlyDEFAULT=
true);
232 std::string
toString(
bool canonicalName =
false,
bool verbose =
false,
233 bool value =
true,
int sampleIndex=0,
int indent = 0)
const ;
235 std::string
toStringAverage(
bool canonicalName =
false,
bool verbose =
false,
236 bool value =
true,
int indent = 0)
const ;
259 bool canonical =
false,
260 bool verbose =
false,
264 int levels = -1 )
const;
268 ::std::vector< ::std::string > & hierarchyList,
269 bool canonical =
false,
270 bool verbose =
false,
271 int sampleIndex = 0 )
const;
275 bool canonical =
false,
276 bool verbose =
false,
279 int levels = -1 )
const;
284 int sampleIndex = 0 )
const;
304 const ::std::string & name,
305 bool caseSensitive );
314 static const Child kNullChild;
316 ::std::vector< Child > children_;
326 carma::monitor::MonitorContainer::Child::Child( ) :
334 carma::monitor::MonitorContainer::Child::isNull( )
const
336 return (componentPtr_ == 0);
341 carma::monitor::MonitorContainer::Child::componentPtr( )
const
343 return componentPtr_;
348 carma::monitor::MonitorContainer::Child::componentRef( )
const
350 if ( componentPtr_ != 0 )
351 return *componentPtr_;
353 return handleBadComponentDeref();
358 carma::monitor::MonitorContainer::Child::isMp( )
const
360 return (flags_ & kMpBitMask);
365 carma::monitor::MonitorContainer::Child::mpPtr( )
const
367 if ( flags_ & kMpBitMask )
368 return static_cast< MonitorPoint *
>( componentPtr_ );
375 carma::monitor::MonitorContainer::Child::mpRef( )
const
377 if ( flags_ & kMpBitMask )
378 return *
static_cast< MonitorPoint *
>( componentPtr_ );
380 return handleBadMpDeref();
385 carma::monitor::MonitorContainer::Child::isContainer( )
const
387 return (flags_ & kContainerBitMask);
392 carma::monitor::MonitorContainer::Child::containerPtr( )
const
394 if ( flags_ & kContainerBitMask )
395 return static_cast< MonitorContainer *
>( componentPtr_ );
402 carma::monitor::MonitorContainer::Child::containerRef( )
const
404 if ( flags_ & kContainerBitMask )
405 return *
static_cast< MonitorContainer *
>( componentPtr_ );
407 return handleBadContainerDeref();
412 carma::monitor::MonitorContainer::Child::isSubsystem( )
const
414 return (flags_ & kSubsystemBitMask);
421 return children_.size();
425 inline const carma::monitor::MonitorContainer::Child &
428 if ( (index >= 0) && (static_cast< size_t >( index ) < children_.size()) )
429 return children_[ index ];
435 inline ::std::vector< carma::monitor::MonitorContainer::Child >
VALIDITY
Validity states of the data value.
virtual bool operator==(const MonitorComponent &component) const
Compares this monitor container for equality to the one passed.
int getNumChildren() const
Get the number of monitor components contained by this component.
~MonitorContainer()
Destructor.
ARCHIVE_PRIORITY
Archiving priority.
virtual ::std::string hierarchyToString(bool canonical=false, bool verbose=false, bool value=true, int sampleIndex=0, int indent=0, int levels=-1) const
Dump this and all contained monitor components to a string.
Abstract base class for all monitor points.
void setArchivePriority(const MonitorComponent::ARCHIVE_PRIORITY priority, bool onlyDEFAULT=true)
Recursively set the archive priority of all monitor points below.
The MonitorComponent class is an interface used to build the monitor hierarchy.
virtual ::std::string monitorPointTags(bool untagged=false) const
Write list of monitor points and their tagIDs to a string, one monitor point per line.
virtual void setMonitorPointAttributes()
Set attributes of all monitor points held anywhere in the hierarchy within (and below) this container...
int getNumMonitorPoints()
Get the total number of monitor points in this container.
bool hasAllData() const
See if all MPs in this component and below have data samples.
virtual int getNumContainerChildren() const
Get the number of child monitor containers contained by this component.
virtual std::string leafToString(bool verbose=false, bool value=true, int sampleIndex=0) const
Dump all leaf nodes below this component to a string.
virtual int getNumDescendants() const
Get the total number of monitor components contained by this component and it's children.
void setValidity(MonitorPoint::VALIDITY validity)
Recursively set validity for all samples of all monitor points below this container.
std::string toString(bool canonicalName=false, bool verbose=false, bool value=true, int sampleIndex=0, int indent=0) const
Write this monitor component to a string.
MonitorPoint & getMonitorPoint(const std::string &name, bool caseSensitive) const
Get a monitor point by name (hierarchical name OK).
MonitorComponent * getComponentPtr(const ::std::string &name, bool caseSensitive) const
Get a contained monitor component by hierarchical name The hierarchical name starts below this contai...
virtual int getNumContainerDescendants() const
Get the number of child monitor containers contained by this component and it's children.
Abstract base class for a monitor point.
void setNoData() const
Recursively mark all data samples as INVALID_NO_DATA.
void add(MonitorComponent &component)
Add a subcomponent to this container A reference is kept to this subcomponent, so the caller is respo...
MonitorPoint & getFirstMonitorPoint()
Recursively find the first monitor point in this container.
virtual void hierarchyToVector(::std::vector< ::std::string > &hierarchyList, bool canonical=false, bool verbose=false, int sampleIndex=0) const
Dump this and all contained monitor component strings into a map hierarchy.
A composite interface used to build the monitor system hierarchy.
virtual ::std::string hierarchyToStringAverage(bool canonical=false, bool verbose=false, bool value=true, int indent=0, int levels=-1) const
Dump this and all contained monitor components to a string.
A generic monitor system container base class.
type definitions for monitor system
virtual void setLocalMonitorPointAttributes()
Set attributes of all monitor points held directly by this container.
int getNumSamples()
Get the total number of samples in this container.
const Child & getChild(int index) const
Get reference to child monitor component by index.
virtual bool isSubsystem() const
Check if the component is a MonitorSubsystem.
std::string toStringAverage(bool canonicalName=false, bool verbose=false, bool value=true, int indent=0) const
Write this monitor component to a string, using frame average values.
::std::vector< Child > getChildVec() const
Get a vector of monitor components contained by this component.
Abstract MonitorSubsystem base class.
void setPersistent(bool persistent)
Set the persistent attribute for the value of a MonitorPoint, or in the case of a container for its d...
virtual void setCanonicalName(const std::string &parents)
Recursively set the canonical component name for this and all below.