CARMA C++
carma::monitor::MonitorComponent Class Referenceabstract

A composite interface used to build the monitor system hierarchy. More...

#include <carma/monitor/MonitorComponent.h>

Inheritance diagram for carma::monitor::MonitorComponent:
carma::monitor::MonitorContainer carma::monitor::MonitorPoint carma::monitor::MonitorDevice carma::monitor::MonitorSystemContainer carma::monitor::MonitorPointBool carma::monitor::MonitorPointComplex carma::monitor::MonitorPointEnum carma::monitor::MonitorPointNumeric carma::monitor::MonitorPointSerialNo carma::monitor::MonitorPointString

Public Types

enum  ARCHIVE_PRIORITY {
  VITAL, USEFUL, NORMAL, DEBUG,
  VERBOSE, DEFAULT, DONTARCHIVE
}
 Archiving priority. More...
 

Public Member Functions

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 hasAllData () const =0
 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 =0
 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 =0
 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 =0
 Dump this and all contained monitor component strings into a map hierarchy. 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...
 
virtual std::string leafToString (bool verbose=false, bool value=true, int sampleIndex=0) const =0
 Dump all leaf nodes below this component to a string. More...
 
 MonitorComponent (const std::string &name)
 Constructor. More...
 
virtual ::std::string monitorPointTags (bool untagged=false) const =0
 Write list of monitor points and their tagIDs to a string, one monitor point per line. More...
 
bool operator!= (const MonitorComponent &component) const
 Checks if components are not equal. More...
 
virtual bool operator== (const MonitorComponent &component) const =0
 Interface (pure virtual) for comparison of components The derived class must implement this method. More...
 
virtual void setCanonicalName (const std::string &parents)
 Recursively set the canonical component name for this and all below. 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...
 
virtual void setNoData () const =0
 Recursively mark all data samples as INVALID_NO_DATA. More...
 
virtual void setPersistent (bool persistent)=0
 Set the persistent attribute for the value of a MonitorPoint, or in the case of a container for its descendants (recursively). 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 toString (bool canonicalName=false, bool verbose=false, bool value=true, int sampleIndex=0, int indent=0) const =0
 Write this monitor component to a string. More...
 
virtual std::string toStringAverage (bool canonicalName=false, bool verbose=false, bool value=true, int indent=0) const =0
 Write this monitor component to a string, using frame average values. More...
 
virtual std::string transportStatisticsToString (bool canonical=false) const
 Dump end-toe-end transport statistics (if available). More...
 
virtual ~MonitorComponent ()
 Destructor. More...
 

Static Public Member Functions

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

bool debug_
 

Related Functions

(Note that these are not member functions.)

std::ostream & operator<< (std::ostream &os, const MonitorComponent &component)
 

Detailed Description

A composite interface used to build the monitor system hierarchy.

Both containers and leaf nodes are derived from this class. Operations can walk down the hierarchy toward the leaf nodes, but not up. This component has constructs for clearing out the samples for all monitor points and setting them to NO_DATA, and for determining when all the monitor points in the container have data.

Definition at line 32 of file MonitorComponent.h.

Member Enumeration Documentation

Archiving priority.

Enumerator
VITAL 

Data is vital for producing science data products; that is, the data cannot be calibrated without this information.

USEFUL 

Data is useful for procesing science data products; that is, the off-line processing software exists to use this data, and it is not uncommon for end users to exploit it.

NORMAL 

Data should be archived by default when performance and bandwidth allow.

It is likely that data of this type will be looked at later. It might be considered a fairly important type of data for debugging the system.

DEBUG 

Data should only be archived under debug mode.

VERBOSE 

Lowest priority level.

To be archived only under very special (debugging) circumstances.

DEFAULT 

This is a place holder for monitor points that have not had their archive priority set.

Methods can then key off this and replace it with a new priority. If it is not replaced it will be treated like DONTARCHIVE.

DONTARCHIVE 

The data should never be archived.

Once set to this value, it can not be changed to anything else. This value is used when a monitor point's tagID was set on the fly.

Definition at line 38 of file MonitorComponent.h.

Constructor & Destructor Documentation

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

Constructor.

Parameters
nameMonitorComponent name (non-hierarchical) Embedded white space is not allowed. An example is "Ovro3" or "mixerCurrent".
virtual carma::monitor::MonitorComponent::~MonitorComponent ( )
virtual

Destructor.

Member Function Documentation

static std::string carma::monitor::MonitorComponent::archivePriorityToString ( MonitorComponent::ARCHIVE_PRIORITY  priority)
static

Get a string representation for an archive priority.

Parameters
priority
static std::string carma::monitor::MonitorComponent::convertAllLower ( std::string  name)
static

Convert a name to all lower case.

Parameters
name
Returns
name converted to lower case
const ::std::string & carma::monitor::MonitorComponent::getCanonicalName ( ) const

Get the canonical component name.

The canonical name begins at the subsystem and represents the physical hierarchy.

See Also
setCanonicalName

Definition at line 439 of file MonitorComponent.h.

virtual const std::string& carma::monitor::MonitorComponent::getDescription ( ) const
virtual

Get the verbose description of the monitor component.

Embedded white space is encouraged, new lines are allowed. An example is "SIS mixer current".

Returns
verbose monitor component description
See Also
setDescription
virtual const std::string& carma::monitor::MonitorComponent::getLongName ( ) const
virtual

Get the long name of the monitor component.

This is the name used for a tooltip style help. Embedded white space is allowed and encouraged. An example is "SIS junction current".

Returns
the long name of the monitor point.
See Also
setLongName
virtual const std::string& carma::monitor::MonitorComponent::getName ( ) const
virtual

Get the component name (leaf part of canonical name).

Returns
the name of the monitor component.
See Also
setName
virtual std::string carma::monitor::MonitorComponent::getPhysicalDeviceName ( ) const
virtual

Get the physical device name, if one exists.

Returns
the physical device name, or a zero length string if there is none

Reimplemented in carma::monitor::MonitorDevice.

std::string carma::monitor::MonitorComponent::getPhysicalDeviceString ( ) const

Get the physical device name, if one exists, enclosed in parentheses.

Returns
the physical device name enclosed in parentheses, or a zero length string if there is none
std::string carma::monitor::MonitorComponent::getPhysicalName ( ) const

Get the physical name, which is location.device.component or if there is no associated physical device it is just component name.

Returns
the physical name
virtual const std::string& carma::monitor::MonitorComponent::getShortName ( ) const
virtual

Get the short name of the monitor component.

This is the name used for a row or column heading. Embedded white space is not allowed. An example is "Ij".

Returns
the short name of the monitor point.
See Also
setShortName
virtual bool carma::monitor::MonitorComponent::hasAllData ( ) const
pure virtual

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

Can be time consuming to check a large branch.

Implemented in carma::monitor::MonitorPoint, and carma::monitor::MonitorContainer.

virtual ::std::string carma::monitor::MonitorComponent::hierarchyToString ( bool  canonical = false,
bool  verbose = false,
bool  value = true,
int  sampleIndex = 0,
int  indent = 0,
int  levels = -1 
) const
pure 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

Implemented in carma::monitor::MonitorPoint, and carma::monitor::MonitorContainer.

virtual ::std::string carma::monitor::MonitorComponent::hierarchyToStringAverage ( bool  canonical = false,
bool  verbose = false,
bool  value = true,
int  indent = 0,
int  levels = -1 
) const
pure 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

Implemented in carma::monitor::MonitorPoint, and carma::monitor::MonitorContainer.

virtual void carma::monitor::MonitorComponent::hierarchyToVector ( ::std::vector< ::std::string > &  hierarchyList,
bool  canonical = false,
bool  verbose = false,
int  sampleIndex = 0 
) const
pure 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

Implemented in carma::monitor::MonitorPoint, and carma::monitor::MonitorContainer.

virtual bool carma::monitor::MonitorComponent::isMonitorPoint ( ) const
virtual

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.

Used to speed up iteration through a monitor hierarchy.

Returns
true if the component is a MonitorPoint or any derivative

Reimplemented in carma::monitor::MonitorPoint.

virtual bool carma::monitor::MonitorComponent::isSubsystem ( ) const
virtual

Check if the component is a MonitorSubsystem.

Returns
true if the component is a MonitorSubsystem

Reimplemented in carma::monitor::MonitorSubsystem.

virtual std::string carma::monitor::MonitorComponent::leafToString ( bool  verbose = false,
bool  value = true,
int  sampleIndex = 0 
) const
pure 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)

Implemented in carma::monitor::MonitorPoint, and carma::monitor::MonitorContainer.

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

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

Parameters
untaggedOnly list those MPs without tagIDs

Implemented in carma::monitor::MonitorPoint, and carma::monitor::MonitorContainer.

bool carma::monitor::MonitorComponent::operator!= ( const MonitorComponent component) const

Checks if components are not equal.

Parameters
componentto compare to this component
See Also
operator==
virtual bool carma::monitor::MonitorComponent::operator== ( const MonitorComponent component) const
pure virtual

Interface (pure virtual) for comparison of components The derived class must implement this method.

Parameters
componentto compare to this component

Implemented in carma::monitor::MonitorPointString, carma::monitor::MonitorPointComplex, carma::monitor::MonitorPoint, carma::monitor::MonitorContainer, and carma::monitor::MonitorPointNumeric.

virtual void carma::monitor::MonitorComponent::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 in carma::monitor::MonitorContainer.

void carma::monitor::MonitorComponent::setDescription ( const std::string &  text)

Set the verbose description of the monitor component.

Parameters
textverbose description of the monitor component. White space allowed.
See Also
getDescription
void carma::monitor::MonitorComponent::setLongName ( const std::string &  name)

Set the long name of the monitor component.

Parameters
namelong name of the monitor component. Embedded white space is allowed and encouraged.
See Also
getLongName
void carma::monitor::MonitorComponent::setName ( const std::string &  name)

Set the leaf part of the canonical name of the monitor component.

Also sets the canonical name.

Parameters
nameof the monitor point. No embedded white space allowed.
See Also
getName
virtual void carma::monitor::MonitorComponent::setNoData ( ) const
pure virtual

Recursively mark all data samples as INVALID_NO_DATA.

Implemented in carma::monitor::MonitorPoint, and carma::monitor::MonitorContainer.

virtual void carma::monitor::MonitorComponent::setPersistent ( bool  persistent)
pure 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.

Implemented in carma::monitor::MonitorPoint, and carma::monitor::MonitorContainer.

void carma::monitor::MonitorComponent::setShortName ( const std::string &  name)

Set the short name of the monitor component.

Parameters
nameshort name of the monitor component. No embedded white space allowed.
See Also
getShortName
void carma::monitor::MonitorComponent::setShortName ( const std::string &  name,
int  index 
)

Set the short name of the monitor component, with an index appended.

Parameters
nameshort name of the monitor component.
index- starting at one, appended to name No embedded white space allowed.
See Also
getShortName
virtual std::string carma::monitor::MonitorComponent::toString ( bool  canonicalName = false,
bool  verbose = false,
bool  value = true,
int  sampleIndex = 0,
int  indent = 0 
) const
pure 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

Implemented in carma::monitor::MonitorPoint, and carma::monitor::MonitorContainer.

virtual std::string carma::monitor::MonitorComponent::toStringAverage ( bool  canonicalName = false,
bool  verbose = false,
bool  value = true,
int  indent = 0 
) const
pure 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

Implemented in carma::monitor::MonitorPoint, and carma::monitor::MonitorContainer.

virtual std::string carma::monitor::MonitorComponent::transportStatisticsToString ( bool  canonical = false) const
virtual

Dump end-toe-end transport statistics (if available).

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
indentfor this level in characters

Reimplemented in carma::monitor::MonitorSystem, and carma::monitor::MonitorSubsystem.

Friends And Related Function Documentation

std::ostream & operator<< ( std::ostream &  os,
const MonitorComponent component 
)
related

Output string representation of component to a stream. This uses the Component::toString() method with default arguments.

* cout << myComponent << endl;
*

might produce output that looks like this:

* mycomponent 3.14
*
Parameters
osoutput ostream
componentto be stringified
Returns
The os output stream parameter so that stream insertions can be chained in the usual C++ way (as shown in the example). Example:
cout<<myComponent<<flush;

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