|
Telescience Resource Kit
TReK C++
5.4.0 ART
|
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 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 depenendcy. | |
uint32_t | GetRemainderValue () |
Returns the remainder value for the counter depenendcy. | |
uint32_t | GetStartCounter () |
Returns the start counter value for the counter depenendcy. | |
virtual bool | Check () |
Checks for the counter dependency. More... | |
![]() | |
enum dependency_type | GetType () |
Returns an enumeration for the type of dependency. | |
const char * | GetDependencyParameter () |
Returns the parameter to use for the counter. | |
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. | |
![]() | |
void | SetName (const char *input_ptr) |
Sets the name of the item. More... | |
void | SetAlias (const char *input) |
Sets the alias of the item. More... | |
void | SetShortDescription (const char *input_ptr) |
Sets the short description of the item. More... | |
void | SetLongDescription (const char *input_ptr) |
Sets the long description of the item. More... | |
void | SetUserDescription (const char *input_ptr) |
Sets the user description of the item. More... | |
void | SetOwner (const char *input_ptr) |
Sets the owner of the item. More... | |
void | SetPath (const char *input_ptr) |
Sets the path for the item. More... | |
const char * | GetName () |
Returns the name of the item. | |
const char * | GetAlias () |
Returns the alias of the item. | |
const char * | GetShortDescription () |
Returns the short description of the item. | |
const char * | GetLongDescription () |
Returns the long description of the item. | |
const char * | GetUserDescription () |
Returns the user description of the item. | |
const char * | GetOwner () |
Returns the owner of the item. | |
const char * | GetPath () |
Returns the path for the item. | |
int32_t | AddAttribute (const char *name, const char *value) |
Adds an attribute to the item. More... | |
void | GetAttributeList (StringArray &attr_array) |
Gets a list of the attribute names. More... | |
int32_t | GetAttribute (const char *name, char *value, uint32_t &value_len) |
Get the value of the specified attribute. More... | |
NamedItem () | |
Default constructor of the class. | |
NamedItem (NamedItem &input) | |
Copy constructor of the class. | |
virtual | ~NamedItem () |
Class destructor. More... | |
void | operator= (NamedItem &right_side) |
Provides the equal operator. | |
bool | operator== (NamedItem &right_side) |
Provides the == operator. | |
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.
|
virtual |
Checks for the counter dependency.
Compares counter's value to the configured data to see if the parameter is included in the packet.
Example:
Implements trek::Dependency.
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: