CARMA C++
|
A generic monitor system container base class. More...
#include <carma/monitor/MonitorContainer.h>
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... | |
MonitorComponent * | 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. More... | |
MonitorPoint & | getFirstMonitorPoint () |
Recursively find the first monitor point in this container. More... | |
MonitorPoint & | getMonitorPoint (const std::string &name, bool caseSensitive) const |
Get a monitor point by name (hierarchical name OK). More... | |
MonitorPoint & | getMonitorPoint (tagIDType tagID) const |
Get a monitor point by tagID. More... | |
MonitorPoint * | getMonitorPointPtr (const std::string &name, bool caseSensitive) const |
MonitorPoint * | getMonitorPointPtr (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... | |
![]() | |
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 | |
![]() | |
enum | ARCHIVE_PRIORITY { VITAL, USEFUL, NORMAL, DEBUG, VERBOSE, DEFAULT, DONTARCHIVE } |
Archiving priority. More... | |
![]() | |
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... | |
![]() | |
bool | debug_ |
![]() | |
std::ostream & | operator<< (std::ostream &os, const MonitorComponent &component) |
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.
|
explicit |
Constructor.
name | for the MonitorContainer |
carma::monitor::MonitorContainer::~MonitorContainer | ( | ) |
Destructor.
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.
component | to 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.
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.
name |
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).
name |
MonitorPoint& carma::monitor::MonitorContainer::getMonitorPoint | ( | tagIDType | tagID | ) | const |
Get a monitor point by tagID.
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 |
Get the number of child monitor containers contained by this component.
|
virtual |
Get the number of child monitor containers contained by this component and it's children.
|
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.
recurse | false 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.
int carma::monitor::MonitorContainer::getNumSamples | ( | ) |
Get the total number of samples in this container.
|
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 |
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.
canonical | determines if canonical or component name is output |
verbose | determines if a terse or verbose dump is done |
value | determines if current value is output |
sampleIndex | (0 is first sample) |
indent | for this level in characters |
levels | number of levels below this to descend; -1 means all |
Implements carma::monitor::MonitorComponent.
|
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.
canonical | determines if canonical or component name is output |
verbose | determines if a terse or verbose dump is done |
value | determines if current value is output |
indent | for this level in characters |
levels | number of levels below this to descend; -1 means all |
Implements carma::monitor::MonitorComponent.
|
virtual |
Dump this and all contained monitor component strings into a map hierarchy.
canonical | determines if canonical or component name is output |
verbose | determines if a terse or verbose dump is done |
Implements carma::monitor::MonitorComponent.
|
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.
verbose | determines if a terse or verbose dump is done |
value | determines if current value is output |
sampleIndex | (0 is first sample) |
Implements carma::monitor::MonitorComponent.
|
virtual |
Write list of monitor points and their tagIDs to a string, one monitor point per line.
untagged | Only list those MPs without tagIDs |
Implements carma::monitor::MonitorComponent.
|
virtual |
Compares this monitor container for equality to the one passed.
The container name must be the same and all components must be equal.
component | to 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.
priority | new archive priority |
onlyDEFAULT | only set the new priority on monitor points that have an archive priority of DEFAULT. Defaults to true. |
|
virtual |
Recursively set the canonical component name for this and all below.
parents | used for levels above this,for example "parents.thisComponent.allbelow..." |
Reimplemented from carma::monitor::MonitorComponent.
|
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.
|
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.
|
virtual |
Recursively mark all data samples as INVALID_NO_DATA.
Implements carma::monitor::MonitorComponent.
|
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).
persistent | true 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)
validity |
|
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.
canonicalName | output canonicalName or leaf name |
verbose | determines if a terse or verbose dump is done |
value | determines if current value is output |
sampleIndex | (0 is first sample) |
indent | for this level (number of characters) |
Implements carma::monitor::MonitorComponent.
|
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.
canonicalName | output canonicalName or leaf name |
verbose | determines if a terse or verbose dump is done |
value | determines if current value is output |
indent | for this level (number of characters) |
Implements carma::monitor::MonitorComponent.