TReK C++
5.3.2
Telemetry/Command API
|
This class determine a parameter's dependency based on a counter. More...
#include <counter_dependency.h>
Inherits trek::Dependency.
Public Member Functions | |
int32_t | LoadFile (const char *filename) |
Loads the CounterDependency definition from the specified file. More... | |
int32_t | SaveFile (const char *filename) |
Saves the CounterDependency definition to the specified file. More... | |
Constructors, Destructor, and Other Basic Methods | |
CounterDependency () | |
Default constructor of the class. | |
CounterDependency (CounterDependency &input) | |
Copy constructor of the class. | |
virtual | ~CounterDependency () |
Class destructor. More... | |
virtual Dependency * | Clone () |
Creates and returns an extact copy of the object. | |
void | operator= (CounterDependency &right_side) |
Provides the equal operator. | |
![]() | |
Dependency () | |
Default constructor of the class. | |
Dependency (Dependency &input) | |
Copy constructor of the class. | |
virtual | ~Dependency () |
Class destructor. More... | |
void | operator= (Dependency &right_side) |
Provides the equal operator. | |
virtual void | Init () |
Initializes the object. | |
Dependency Methods | |
int32_t | Configure (const char *name, uint32_t mod_value, uint32_t remainder_value) |
Configures the counter dependency. More... | |
void | SetStartCounter (uint32_t input) |
Sets a start counter for the dependency. More... | |
uint32_t | GetModuloValue () |
Returns the modulo value for the counter depenency. | |
uint32_t | GetRemainderValue () |
Returns the remainder value for the counter depenency. | |
uint32_t | GetStartCounter () |
Returns the start counter value for the counter depenency. | |
const char * | GetDependencyParameter () |
Returns the parameter to use for the counter. | |
This class determine a parameter's dependency based on a counter.
For parameter X with a dependency on Parameter Y, the remainder from the modulo operator on the counter value (Y) determines if the parameter should be included.
value(Y) % mod_value == remainder
|
virtual |
Class destructor.
Removes all resources created with this instance of the class.
int32_t trek::CounterDependency::Configure | ( | const char * | name, |
uint32_t | mod_value, | ||
uint32_t | remainder_value | ||
) |
Configures the counter dependency.
Sets the parameter to check for dependency as well as the required attributes. The parameter name is not checked on input for existence in the containing packet. This check will be performed when validation is available at the packet level.
[in] | name | The name of the parameter whose value is checked. |
[in] | mod_value | The modulo value. |
[in] | remainder_value | The remainder that must match for the value % mod_value. |
Example:
int32_t trek::CounterDependency::LoadFile | ( | const char * | filename | ) |
Loads the CounterDependency definition from the specified file.
Reads an XML format for the CounterDependency. It can be written in with SaveFile.
[in] | filename | The file to load the parameter object from. |
Example:
int32_t trek::CounterDependency::SaveFile | ( | const char * | filename | ) |
Saves the CounterDependency definition to the specified file.
Writes an XML format for the CounterDependency. It can be read in with LoadFile.
[in] | filename | The file to save the parameter object to. |
Example:
void trek::CounterDependency::SetStartCounter | ( | uint32_t | input | ) |
Sets a start counter for the dependency.
If a start counter is defined, then the dependency check will return false (fail) if the counter value is not greater than or equal to the value specified. The default start counter value is 0. Example: