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

A generic monitor system container base class. More...

#include <carma/monitor/MonitorContainer.h>

Inheritance diagram for carma::monitor::MonitorContainer:
carma::monitor::MonitorComponent carma::monitor::MonitorDevice carma::monitor::MonitorSystemContainer carma::monitor::MonitorSubsystem carma::monitor::MonitorSystem carma::monitor::CarmaMonitorSystem carma::monitor::FinalCarmaMonitorSystem carma::monitor::RawCarmaMonitorSystem

Public Member Functions

void add (MonitorComponent &component)
 Add a subcomponent to this container A reference is kept to this subcomponent, so the caller is responsible for managing the lifecycle of the subcomponent; this container simply expects that it be available for access. More...
 
const Child & getChild (int index) const
 Get reference to child monitor component by index. More...
 
::std::vector< Child > getChildVec () const
 Get a vector of monitor components contained by this component. More...
 
MonitorComponentgetComponentPtr (const ::std::string &name, bool caseSensitive) const
 Get a contained monitor component by hierarchical name The hierarchical name starts below this container and consist of dot (".") separated components. More...
 
MonitorPointgetFirstMonitorPoint ()
 Recursively find the first monitor point in this container. More...
 
MonitorPointgetMonitorPoint (const std::string &name, bool caseSensitive) const
 Get a monitor point by name (hierarchical name OK). More...
 
MonitorPointgetMonitorPoint (tagIDType tagID) const
 Get a monitor point by tagID. More...
 
MonitorPointgetMonitorPointPtr (const std::string &name, bool caseSensitive) const
 
MonitorPointgetMonitorPointPtr (tagIDType tagID) const
 
int getNumChildren () const
 Get the number of monitor components contained by this component. More...
 
virtual int getNumContainerChildren () const
 Get the number of child monitor containers contained by this component. More...
 
virtual int getNumContainerDescendants () const
 Get the number of child monitor containers contained by this component and it's children. More...
 
virtual int getNumDescendants () const
 Get the total number of monitor components contained by this component and it's children. More...
 
int getNumMonitorPoints (bool recurse=false) const
 Get the number of monitor points. More...
 
int getNumMonitorPoints ()
 Get the total number of monitor points in this container. More...
 
int getNumSamples ()
 Get the total number of samples in this container. More...
 
bool hasAllData () const
 See if all MPs in this component and below have data samples. More...
 
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. More...
 
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. More...
 
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. More...
 
virtual std::string leafToString (bool verbose=false, bool value=true, int sampleIndex=0) const
 Dump all leaf nodes below this component to a string. More...
 
 MonitorContainer (const ::std::string &name)
 Constructor. More...
 
virtual ::std::string monitorPointTags (bool untagged=false) const
 Write list of monitor points and their tagIDs to a string, one monitor point per line. More...
 
virtual bool operator== (const MonitorComponent &component) const
 Compares this monitor container for equality to the one passed. More...
 
void setArchivePriority (const MonitorComponent::ARCHIVE_PRIORITY priority, bool onlyDEFAULT=true)
 Recursively set the archive priority of all monitor points below. More...
 
virtual void setCanonicalName (const std::string &parents)
 Recursively set the canonical component name for this and all below. More...
 
virtual void setMonitorPointAttributes ()
 Set attributes of all monitor points held anywhere in the hierarchy within (and below) this container. More...
 
void setNoData () const
 Recursively mark all data samples as INVALID_NO_DATA. More...
 
void setPersistent (bool persistent)
 Set the persistent attribute for the value of a MonitorPoint, or in the case of a container for its descendants (recursively). More...
 
void setValidity (MonitorPoint::VALIDITY validity)
 Recursively set validity for all samples of all monitor points below this container. More...
 
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. More...
 
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. More...
 
 ~MonitorContainer ()
 Destructor. More...
 
- Public Member Functions inherited from carma::monitor::MonitorComponent
const std::string & getCanonicalName () const
 Get the canonical component name. More...
 
virtual const std::string & getDescription () const
 Get the verbose description of the monitor component. More...
 
virtual const std::string & getLongName () const
 Get the long name of the monitor component. More...
 
virtual const std::string & getName () const
 Get the component name (leaf part of canonical name). More...
 
virtual std::string getPhysicalDeviceName () const
 Get the physical device name, if one exists. More...
 
std::string getPhysicalDeviceString () const
 Get the physical device name, if one exists, enclosed in parentheses. More...
 
std::string getPhysicalName () const
 Get the physical name, which is location.device.component or if there is no associated physical device it is just component name. More...
 
virtual const std::string & getShortName () const
 Get the short name of the monitor component. More...
 
virtual bool isMonitorPoint () const
 Identifies this component as a MonitorPoint or any derivative Should be over-ridden by the MonitorPoint class; others that don't derive from MP can use this default implementation. More...
 
virtual bool isSubsystem () const
 Check if the component is a MonitorSubsystem. More...
 
 MonitorComponent (const std::string &name)
 Constructor. More...
 
bool operator!= (const MonitorComponent &component) const
 Checks if components are not equal. More...
 
void setDescription (const std::string &text)
 Set the verbose description of the monitor component. More...
 
void setLongName (const std::string &name)
 Set the long name of the monitor component. More...
 
void setName (const std::string &name)
 Set the leaf part of the canonical name of the monitor component. More...
 
void setShortName (const std::string &name)
 Set the short name of the monitor component. More...
 
void setShortName (const std::string &name, int index)
 Set the short name of the monitor component, with an index appended. More...
 
virtual std::string transportStatisticsToString (bool canonical=false) const
 Dump end-toe-end transport statistics (if available). More...
 
virtual ~MonitorComponent ()
 Destructor. More...
 

Protected Member Functions

virtual void setLocalMonitorPointAttributes ()
 Set attributes of all monitor points held directly by this container. More...
 

Static Protected Member Functions

static Child findDescendant (const MonitorContainer &rootContainer, const ::std::string &name, bool caseSensitive)
 

Additional Inherited Members

- Public Types inherited from carma::monitor::MonitorComponent
enum  ARCHIVE_PRIORITY {
  VITAL, USEFUL, NORMAL, DEBUG,
  VERBOSE, DEFAULT, DONTARCHIVE
}
 Archiving priority. More...
 
- Static Public Member Functions inherited from carma::monitor::MonitorComponent
static std::string archivePriorityToString (MonitorComponent::ARCHIVE_PRIORITY priority)
 Get a string representation for an archive priority. More...
 
static std::string convertAllLower (std::string name)
 Convert a name to all lower case. More...
 
- Protected Attributes inherited from carma::monitor::MonitorComponent
bool debug_
 

Detailed Description

A generic monitor system container base class.

The container holds other containers and monitor points. Monitor points are always the leaf nodes in this hierarchy. The container has constructs for clearing out the samples for all monitor points and setting them to INVALID_NO_DATA, and for determining when all the monitor points in the container have data.

Definition at line 42 of file MonitorContainer.h.

Constructor & Destructor Documentation

carma::monitor::MonitorContainer::MonitorContainer ( const ::std::string &  name)
explicit

Constructor.

Parameters
namefor the MonitorContainer
carma::monitor::MonitorContainer::~MonitorContainer ( )

Destructor.

Member Function Documentation

void carma::monitor::MonitorContainer::add ( MonitorComponent component)

Add a subcomponent to this container A reference is kept to this subcomponent, so the caller is responsible for managing the lifecycle of the subcomponent; this container simply expects that it be available for access.

Parameters
componentto add below this component in the hierarchy
const carma::monitor::MonitorContainer::Child & carma::monitor::MonitorContainer::getChild ( int  index) const

Get reference to child monitor component by index.

Parameters
index

Definition at line 426 of file MonitorContainer.h.

std::vector< carma::monitor::MonitorContainer::Child > carma::monitor::MonitorContainer::getChildVec ( ) const

Get a vector of monitor components contained by this component.

Definition at line 436 of file MonitorContainer.h.

MonitorComponent* carma::monitor::MonitorContainer::getComponentPtr ( const ::std::string &  name,
bool  caseSensitive 
) const

Get a contained monitor component by hierarchical name The hierarchical name starts below this container and consist of dot (".") separated components.

Parameters
name
Returns
pointer to the requested component, or a null if not found
MonitorPoint& carma::monitor::MonitorContainer::getFirstMonitorPoint ( )

Recursively find the first monitor point in this container.

If there is none, a null reference will be returned.

MonitorPoint& carma::monitor::MonitorContainer::getMonitorPoint ( const std::string &  name,
bool  caseSensitive 
) const

Get a monitor point by name (hierarchical name OK).

Parameters
name
MonitorPoint& carma::monitor::MonitorContainer::getMonitorPoint ( tagIDType  tagID) const

Get a monitor point by tagID.

Parameters
tagID
int carma::monitor::MonitorContainer::getNumChildren ( ) const

Get the number of monitor components contained by this component.

Definition at line 419 of file MonitorContainer.h.

virtual int carma::monitor::MonitorContainer::getNumContainerChildren ( ) const
virtual

Get the number of child monitor containers contained by this component.

virtual int carma::monitor::MonitorContainer::getNumContainerDescendants ( ) const
virtual

Get the number of child monitor containers contained by this component and it's children.

virtual int carma::monitor::MonitorContainer::getNumDescendants ( ) const
virtual

Get the total number of monitor components contained by this component and it's children.

int carma::monitor::MonitorContainer::getNumMonitorPoints ( bool  recurse = false) const

Get the number of monitor points.

Parameters
recursefalse gives only MPs in this container, while true gives total of this container and all below.
int carma::monitor::MonitorContainer::getNumMonitorPoints ( )

Get the total number of monitor points in this container.

Returns
total number of monitor points in this container
int carma::monitor::MonitorContainer::getNumSamples ( )

Get the total number of samples in this container.

Returns
total number of samples in this container
bool carma::monitor::MonitorContainer::hasAllData ( ) const
virtual

See if all MPs in this component and below have data samples.

Can be time consuming to check a large branch.

Implements carma::monitor::MonitorComponent.

virtual ::std::string carma::monitor::MonitorContainer::hierarchyToString ( bool  canonical = false,
bool  verbose = false,
bool  value = true,
int  sampleIndex = 0,
int  indent = 0,
int  levels = -1 
) const
virtual

Dump this and all contained monitor components to a string.

The string will potentially have many lines, and will end with a new line in all cases.

Parameters
canonicaldetermines if canonical or component name is output
verbosedetermines if a terse or verbose dump is done
valuedetermines if current value is output
sampleIndex(0 is first sample)
indentfor this level in characters
levelsnumber of levels below this to descend; -1 means all

Implements carma::monitor::MonitorComponent.

virtual ::std::string carma::monitor::MonitorContainer::hierarchyToStringAverage ( bool  canonical = false,
bool  verbose = false,
bool  value = true,
int  indent = 0,
int  levels = -1 
) const
virtual

Dump this and all contained monitor components to a string.

The frame average value is output. The string will potentially have many lines, and will end with a new line in all cases.

Parameters
canonicaldetermines if canonical or component name is output
verbosedetermines if a terse or verbose dump is done
valuedetermines if current value is output
indentfor this level in characters
levelsnumber of levels below this to descend; -1 means all

Implements carma::monitor::MonitorComponent.

virtual void carma::monitor::MonitorContainer::hierarchyToVector ( ::std::vector< ::std::string > &  hierarchyList,
bool  canonical = false,
bool  verbose = false,
int  sampleIndex = 0 
) const
virtual

Dump this and all contained monitor component strings into a map hierarchy.

Parameters
canonicaldetermines if canonical or component name is output
verbosedetermines if a terse or verbose dump is done

Implements carma::monitor::MonitorComponent.

virtual std::string carma::monitor::MonitorContainer::leafToString ( bool  verbose = false,
bool  value = true,
int  sampleIndex = 0 
) const
virtual

Dump all leaf nodes below this component to a string.

Leaf nodes should be MonitorPoints (or a subclass thereof). The string will potentially have many lines, and will end with a new line in all cases. The canonical name is used in the output.

Parameters
verbosedetermines if a terse or verbose dump is done
valuedetermines if current value is output
sampleIndex(0 is first sample)

Implements carma::monitor::MonitorComponent.

virtual ::std::string carma::monitor::MonitorContainer::monitorPointTags ( bool  untagged = false) const
virtual

Write list of monitor points and their tagIDs to a string, one monitor point per line.

Parameters
untaggedOnly list those MPs without tagIDs

Implements carma::monitor::MonitorComponent.

virtual bool carma::monitor::MonitorContainer::operator== ( const MonitorComponent component) const
virtual

Compares this monitor container for equality to the one passed.

The container name must be the same and all components must be equal.

Parameters
componentto compare to this component

Implements carma::monitor::MonitorComponent.

void carma::monitor::MonitorContainer::setArchivePriority ( const MonitorComponent::ARCHIVE_PRIORITY  priority,
bool  onlyDEFAULT = true 
)

Recursively set the archive priority of all monitor points below.

Parameters
prioritynew archive priority
onlyDEFAULTonly set the new priority on monitor points that have an archive priority of DEFAULT. Defaults to true.
virtual void carma::monitor::MonitorContainer::setCanonicalName ( const std::string &  parents)
virtual

Recursively set the canonical component name for this and all below.

Parameters
parentsused for levels above this,for example "parents.thisComponent.allbelow..."
See Also
getCanonicalName

Reimplemented from carma::monitor::MonitorComponent.

virtual void carma::monitor::MonitorContainer::setLocalMonitorPointAttributes ( )
protectedvirtual

Set attributes of all monitor points held directly by this container.

These attributes, such as long name, sample rate, etc., may be set when the MPs are created or the attributes may be gotten from a configuration file/dbms and applied here. The default version of this method does nothing. However, it is overridden in MPML generated code all over the place.

See Also
setMonitorPointAttributes
virtual void carma::monitor::MonitorContainer::setMonitorPointAttributes ( )
virtual

Set attributes of all monitor points held anywhere in the hierarchy within (and below) this container.

These attributes, such as long name, sample rate, etc., may be set when the MPs are created or the attributes may be gotten from a configuration file/dbms and applied here. The default version of this method first calls the setLocalMonitorPointAttributes() method, then it calls the setMonitorPointAttributes() method of all containers held within this container.

See Also
setLocalMonitorPointAttributes
void carma::monitor::MonitorContainer::setNoData ( ) const
virtual

Recursively mark all data samples as INVALID_NO_DATA.

Implements carma::monitor::MonitorComponent.

void carma::monitor::MonitorContainer::setPersistent ( bool  persistent)
virtual

Set the persistent attribute for the value of a MonitorPoint, or in the case of a container for its descendants (recursively).

Note that this method has no effect on a running FSP, which gets its persistence info from the MPML file. I.e. you can't change the persistence of a monitor point programmatically (dynamically).

Parameters
persistenttrue if the component's value is to be persistent across frames; false if it is to be invalidated after every frame is set.

Implements carma::monitor::MonitorComponent.

void carma::monitor::MonitorContainer::setValidity ( MonitorPoint::VALIDITY  validity)

Recursively set validity for all samples of all monitor points below this container.

This is all points that derive from MonitorPoint (sense, monitor, control)

Parameters
validity
std::string carma::monitor::MonitorContainer::toString ( bool  canonicalName = false,
bool  verbose = false,
bool  value = true,
int  sampleIndex = 0,
int  indent = 0 
) const
virtual

Write this monitor component to a string.

If verbose, the string may have multiple lines but is guaranteed to be terminated with a newline. If not verbose, the string is guaranteed to be a single line without a newline.

Parameters
canonicalNameoutput canonicalName or leaf name
verbosedetermines if a terse or verbose dump is done
valuedetermines if current value is output
sampleIndex(0 is first sample)
indentfor this level (number of characters)
See Also
toStringAverage

Implements carma::monitor::MonitorComponent.

std::string carma::monitor::MonitorContainer::toStringAverage ( bool  canonicalName = false,
bool  verbose = false,
bool  value = true,
int  indent = 0 
) const
virtual

Write this monitor component to a string, using frame average values.

If verbose, the string may have multiple lines but is guaranteed to be terminated with a newline. If not verbose, the string is guaranteed to be a single line without a newline.

Parameters
canonicalNameoutput canonicalName or leaf name
verbosedetermines if a terse or verbose dump is done
valuedetermines if current value is output
indentfor this level (number of characters)
See Also
toString

Implements carma::monitor::MonitorComponent.


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