CARMA C++
MonitorComponent.h
Go to the documentation of this file.
1 #ifndef CARMA_MONITOR_MONITORCOMPONENT_H
2 #define CARMA_MONITOR_MONITORCOMPONENT_H
3 
4 
16 #include <string>
17 #include <vector>
18 
19 namespace carma {
20  namespace monitor {
21 
33 public:
34 
44 
51 
59 
64 
70 
78 
85  };
86 
93  explicit MonitorComponent(const std::string& name);
94 
98  virtual ~MonitorComponent() ;
99 
105  virtual const std::string& getName() const ;
106 
114  void setName(const std::string& name);
115 
122  const std::string& getCanonicalName() const ;
123 
130  virtual void setCanonicalName( const std::string & parents );
131 
140  virtual const std::string& getShortName() const ;
141 
148  void setShortName(const std::string& name);
149 
157  void setShortName(const std::string& name, int index);
158 
167  virtual const std::string& getLongName() const ;
168 
175  void setLongName(const std::string& name);
176 
184  virtual const std::string& getDescription() const ;
185 
192  void setDescription(const std::string& text);
193 
197  virtual void setNoData() const = 0;
198 
203  virtual bool hasAllData() const = 0;
204 
205 
210  virtual bool isSubsystem() const;
211 
219  virtual std::string transportStatisticsToString(bool canonical = false) const;
220 
232  virtual ::std::string hierarchyToString(
233  bool canonical = false,
234  bool verbose = false,
235  bool value = true,
236  int sampleIndex = 0,
237  int indent = 0,
238  int levels = -1 ) const = 0;
239 
245  virtual void hierarchyToVector(
246  ::std::vector< ::std::string > & hierarchyList,
247  bool canonical = false,
248  bool verbose = false,
249  int sampleIndex = 0 ) const = 0;
250 
262  virtual ::std::string hierarchyToStringAverage(
263  bool canonical = false,
264  bool verbose = false,
265  bool value = true,
266  int indent = 0,
267  int levels = -1 ) const = 0;
268 
279  virtual std::string leafToString( bool verbose = false,
280  bool value = true,
281  int sampleIndex = 0 ) const = 0;
282 
296  virtual std::string toString(bool canonicalName = false,
297  bool verbose = false, bool value = true,
298  int sampleIndex = 0, int indent = 0) const = 0;
299 
312  virtual std::string toStringAverage(bool canonicalName = false,
313  bool verbose = false, bool value = true,
314  int indent = 0) const = 0;
315 
321  virtual ::std::string monitorPointTags( bool untagged = false ) const = 0;
322 
328  virtual std::string getPhysicalDeviceName() const ;
329 
335  std::string getPhysicalDeviceString() const ;
336 
342  std::string getPhysicalName() const ;
343 
349  static std::string convertAllLower(std::string name) ;
350 
361  virtual void setPersistent(bool persistent) = 0;
362 
370  virtual bool isMonitorPoint() const;
371 
376  static std::string archivePriorityToString(
378 
384  virtual bool operator==(const MonitorComponent& component) const = 0;
385 
391  bool operator!=(const MonitorComponent& component) const ;
392 
393 private:
394  // No copying
395  MonitorComponent & operator=( const MonitorComponent & rhs );
396  MonitorComponent( const MonitorComponent & rhs );
397 
398  MonitorComponent( ); // Default constructor is private!!
399 
400 protected:
401  bool debug_;
402 
403 private:
404  std::string name_;
405  std::string canonicalName_;
406  std::string shortName_;
407  std::string longName_;
408  std::string description_;
409 };
410 
411 
431 std::ostream& operator<<(std::ostream &os, const MonitorComponent& component);
432 
433 
434 } // namespace carma::monitor
435 } // namespace carma
436 
437 
438 inline const ::std::string &
440 {
441  return canonicalName_ ;
442 }
443 
444 
445 #endif
virtual const std::string & getName() const
Get the component name (leaf part of canonical name).
virtual const std::string & getLongName() const
Get the long name of the monitor component.
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.
void setLongName(const std::string &name)
Set the long name of the monitor component.
ARCHIVE_PRIORITY
Archiving priority.
Data is vital for producing science data products; that is, the data cannot be calibrated without thi...
This is a place holder for monitor points that have not had their archive priority set...
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.
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.
static std::string archivePriorityToString(MonitorComponent::ARCHIVE_PRIORITY priority)
Get a string representation for an archive priority.
Data should be archived by default when performance and bandwidth allow.
std::string getPhysicalDeviceString() const
Get the physical device name, if one exists, enclosed in parentheses.
The data should never be archived.
Data is useful for procesing science data products; that is, the off-line processing software exists ...
virtual void setCanonicalName(const std::string &parents)
Recursively set the canonical component name for this and all below.
Data should only be archived under debug mode.
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.
std::ostream & operator<<(std::ostream &os, const MonitorComponent &component)
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.
void setName(const std::string &name)
Set the leaf part of the canonical name of the monitor component.
void setShortName(const std::string &name)
Set the short name of the monitor component.
virtual std::string getPhysicalDeviceName() const
Get the physical device name, if one exists.
virtual bool operator==(const MonitorComponent &component) const =0
Interface (pure virtual) for comparison of components The derived class must implement this method...
virtual bool isMonitorPoint() const
Identifies this component as a MonitorPoint or any derivative Should be over-ridden by the MonitorPoi...
virtual bool hasAllData() const =0
See if all MPs in this component and below have data samples.
virtual const std::string & getShortName() const
Get the short name of the monitor component.
virtual std::string transportStatisticsToString(bool canonical=false) const
Dump end-toe-end transport statistics (if available).
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.
virtual void setNoData() const =0
Recursively mark all data samples as INVALID_NO_DATA.
A composite interface used to build the monitor system hierarchy.
virtual const std::string & getDescription() const
Get the verbose description of the monitor component.
bool operator!=(const MonitorComponent &component) const
Checks if components are not equal.
static std::string convertAllLower(std::string name)
Convert a name to all lower case.
std::string getPhysicalName() const
Get the physical name, which is location.device.component or if there is no associated physical devic...
const std::string & getCanonicalName() const
Get the canonical component name.
void setDescription(const std::string &text)
Set the verbose description of the monitor component.
virtual bool isSubsystem() const
Check if the component is a MonitorSubsystem.
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.
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 d...
virtual ~MonitorComponent()
Destructor.