Public Member Functions | Private Member Functions | Private Attributes | List of all members
cras::FrequencyStatusParam Class Reference

An extension of diagnostic_updater::FrequencyStatusParam that allows passing non-pointer min/max frequency values. If the internal pointers are used, they are correctly handled when copying this object (the new copy will have its own copy of the internal pointers). More...

#include <topic_status_param.hpp>

Inheritance diagram for cras::FrequencyStatusParam:
Inheritance graph
[legend]

Public Member Functions

 FrequencyStatusParam (double *min_freq, double *max_freq, double tolerance=0.1, int window_size=5)
 The original constructor from diagnostic_updater::FrequencyStatusParam. More...
 
 FrequencyStatusParam (double min_freq=0.0, double max_freq=::std::numeric_limits< double >::infinity(), double tolerance=0.1, int window_size=5)
 The added constructor not requiring pointers. More...
 
 FrequencyStatusParam (const ::cras::FrequencyStatusParam &other)
 Copy values from another object of this type. If it uses the internal pointers, their values are copied and a new set of internal pointers is created for this object, making it independent of the other one. If the other object uses explicit pointer, this object will use pointers to the same memory. More...
 
 FrequencyStatusParam (const ::diagnostic_updater::FrequencyStatusParam &other)
 Copy values from the original diagnostic_updater::FrequencyStatusParam. This object will use pointers to the same memory for min/max rate as the other one. More...
 
 FrequencyStatusParam (const ::cras::SimpleTopicStatusParamNoHeader &params)
 Initialize this object from SimpleTopicStatusParam. Internal pointers for min/max rate will be used, so the params object may cease to exist. More...
 
double getExpectedRate () const
 Get the expected/average rate. If min and max are the same, their value will be returned. If min rate is non-positive, the max rate is returned. Otherwise, if max rate is infinite, the min rate will be returned. If min is positive and max is finite, their arithmetic mean is returned. More...
 
::cras::FrequencyStatusParamoperator= (const ::cras::FrequencyStatusParam &other)
 Copy values from another object of this type. If it uses the internal pointers, their values are copied and a new set of internal pointers is created for this object, making it independent of the other one. If the other object uses explicit pointer, this object will use pointers to the same memory. More...
 
::cras::FrequencyStatusParamoperator= (const ::diagnostic_updater::FrequencyStatusParam &other)
 Copy values from the original diagnostic_updater::FrequencyStatusParam. This object will use pointers to the same memory for min/max rate as the other one. More...
 
- Public Member Functions inherited from diagnostic_updater::FrequencyStatusParam
 FrequencyStatusParam (double *min_freq, double *max_freq, double tolerance=0.1, int window_size=5)
 

Private Member Functions

void copyAdditionalData (const ::cras::FrequencyStatusParam &other)
 This method handles copying of the internal pointers if they are used. More...
 

Private Attributes

double maxFreq {::std::numeric_limits<double>::infinity()}
 Maximum frequency. This field is used by the internal pointers if they are used, otherwise it is ignored. More...
 
double minFreq {0.0}
 Minimum frequency. This field is used by the internal pointers if they are used, otherwise it is ignored. More...
 
bool usesInternalPointers {false}
 Whether internal pointers are used or not (depends on whether this object was constructed with explicit rate pointers or not). More...
 

Additional Inherited Members

- Public Attributes inherited from diagnostic_updater::FrequencyStatusParam
double * max_freq_
 
double * min_freq_
 
double tolerance_
 
int window_size_
 

Detailed Description

An extension of diagnostic_updater::FrequencyStatusParam that allows passing non-pointer min/max frequency values. If the internal pointers are used, they are correctly handled when copying this object (the new copy will have its own copy of the internal pointers).

Definition at line 119 of file topic_status_param.hpp.

Constructor & Destructor Documentation

◆ FrequencyStatusParam() [1/5]

cras::FrequencyStatusParam::FrequencyStatusParam ( double *  min_freq,
double *  max_freq,
double  tolerance = 0.1,
int  window_size = 5 
)

The original constructor from diagnostic_updater::FrequencyStatusParam.

Parameters
[in]min_freqPointer to a double containing the minimum allowed frequency. Cannot be nullptr.
[in]max_freqPointer to a double containing the maximum allowed frequency. Cannot be nullptr.
[in]toleranceTolerance of the rate.
[in]window_sizeNumber of updates during which the frequency is computed.

◆ FrequencyStatusParam() [2/5]

cras::FrequencyStatusParam::FrequencyStatusParam ( double  min_freq = 0.0,
double  max_freq = ::std::numeric_limits< double >::infinity(),
double  tolerance = 0.1,
int  window_size = 5 
)
explicit

The added constructor not requiring pointers.

Parameters
[in]min_freqMinimum allowed frequency.
[in]max_freqMaximum allowed frequency.
[in]toleranceTolerance of the rate.
[in]window_sizeNumber of updates during which the frequency is computed.
Note
Internal pointers for min/max rate are used.

◆ FrequencyStatusParam() [3/5]

cras::FrequencyStatusParam::FrequencyStatusParam ( const ::cras::FrequencyStatusParam other)

Copy values from another object of this type. If it uses the internal pointers, their values are copied and a new set of internal pointers is created for this object, making it independent of the other one. If the other object uses explicit pointer, this object will use pointers to the same memory.

Parameters
[in]otherThe object to copy from.

◆ FrequencyStatusParam() [4/5]

cras::FrequencyStatusParam::FrequencyStatusParam ( const ::diagnostic_updater::FrequencyStatusParam other)

Copy values from the original diagnostic_updater::FrequencyStatusParam. This object will use pointers to the same memory for min/max rate as the other one.

Parameters
[in]otherThe object to copy from.

◆ FrequencyStatusParam() [5/5]

cras::FrequencyStatusParam::FrequencyStatusParam ( const ::cras::SimpleTopicStatusParamNoHeader params)

Initialize this object from SimpleTopicStatusParam. Internal pointers for min/max rate will be used, so the params object may cease to exist.

Parameters
[in]paramsThe parameters to initialize with.

Member Function Documentation

◆ copyAdditionalData()

void cras::FrequencyStatusParam::copyAdditionalData ( const ::cras::FrequencyStatusParam other)
private

This method handles copying of the internal pointers if they are used.

Parameters
[in]other

◆ getExpectedRate()

double cras::FrequencyStatusParam::getExpectedRate ( ) const

Get the expected/average rate. If min and max are the same, their value will be returned. If min rate is non-positive, the max rate is returned. Otherwise, if max rate is infinite, the min rate will be returned. If min is positive and max is finite, their arithmetic mean is returned.

Returns
The expected rate (in Hz).

◆ operator=() [1/2]

::cras::FrequencyStatusParam& cras::FrequencyStatusParam::operator= ( const ::cras::FrequencyStatusParam other)

Copy values from another object of this type. If it uses the internal pointers, their values are copied and a new set of internal pointers is created for this object, making it independent of the other one. If the other object uses explicit pointer, this object will use pointers to the same memory.

Parameters
[in]otherThe object to copy from.

◆ operator=() [2/2]

::cras::FrequencyStatusParam& cras::FrequencyStatusParam::operator= ( const ::diagnostic_updater::FrequencyStatusParam other)

Copy values from the original diagnostic_updater::FrequencyStatusParam. This object will use pointers to the same memory for min/max rate as the other one.

Parameters
[in]otherThe object to copy from.

Member Data Documentation

◆ maxFreq

double cras::FrequencyStatusParam::maxFreq {::std::numeric_limits<double>::infinity()}
private

Maximum frequency. This field is used by the internal pointers if they are used, otherwise it is ignored.

Definition at line 199 of file topic_status_param.hpp.

◆ minFreq

double cras::FrequencyStatusParam::minFreq {0.0}
private

Minimum frequency. This field is used by the internal pointers if they are used, otherwise it is ignored.

Definition at line 196 of file topic_status_param.hpp.

◆ usesInternalPointers

bool cras::FrequencyStatusParam::usesInternalPointers {false}
private

Whether internal pointers are used or not (depends on whether this object was constructed with explicit rate pointers or not).

Definition at line 203 of file topic_status_param.hpp.


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


cras_cpp_common
Author(s): Martin Pecka
autogenerated on Sat Jun 17 2023 02:32:53