TReK C++  5.3.3
Telemetry/Command API
trek::LimitAlarmSwitchSet Class Reference

This class switches limit sets. More...

#include <limit_alarm_switch_set.h>

Inherits trek::SwitchSet.

Public Member Functions

int32_t AddLimitAlarm (LimitAlarm *input)
 Adds a limit alarm. More...
 
int32_t AddLimitAlarm (LimitAlarm &input)
 Adds a limit alarm. More...
 
int32_t DeleteLimitAlarm (const char *name)
 Deletes the specified limit alarm. More...
 
void DeleteAllLimitAlarms ()
 Deletes all of the limit alarms. More...
 
LimitAlarmGetLimitAlarm (const char *name)
 Returns the limit alarm with the specified name. More...
 
int32_t Check (double value, ParameterStatus &status)
 Checks the input value for alarm violations. More...
 
int32_t Check (int64_t value, ParameterStatus &status)
 Checks the input value for alarm violations. More...
 
int32_t Check (uint64_t value, ParameterStatus &status)
 Checks the input value for alarm violations. More...
 
lass_limit_type GetLimitAlarmType ()
 Gets the limit type contained in the switch set. More...
 
Constructors, Destructor, and Other Basic Methods
 LimitAlarmSwitchSet ()
 Default constructor of the class.
 
 LimitAlarmSwitchSet (LimitAlarmSwitchSet &input)
 Copy constructor of the class.
 
virtual ~LimitAlarmSwitchSet ()
 Class destructor. More...
 
virtual SwitchSetClone ()
 Creates and returns an extact copy of the object.
 
void operator= (LimitAlarmSwitchSet &right_side)
 Provides the equal operator.
 
Serialization Methods

These methods help read and write the class to disk or memory. Most users will not be interested in these. Those that are can continue reading.

int32_t LoadFile (const char *filename)
 Loads the Packet definition from the specified file. More...
 
int32_t SaveFile (const char *filename)
 Saves the Packet definition to the specified file. More...
 
virtual int32_t ToXml (XmlElement &element)
 
virtual int32_t FromXml (XmlElement &element)
 
- Public Member Functions inherited from trek::SwitchSet
int32_t SetDefaultSetName (const char *name)
 Sets the default set name. More...
 
const char * GetDefaultSetName ()
 Gets the default set name. More...
 
int32_t SetSwitchParameterName (const char *name)
 Sets the name of the parameter to use as a switch. More...
 
const char * GetSwitchParameterName ()
 Gets the parameter name for the switch. More...
 
void SetSwitchType (switch_type input)
 Sets the type of switch to use. More...
 
switch_type GetSwitchType ()
 Returns the current switch type. More...
 
int32_t SetSwitchParameter (Parameter *input_ptr)
 Sets the parameter to use for switching. More...
 
int32_t AddRangeSwitch (double low, double high, const char *name)
 Adds a range switch. More...
 
int32_t AddEnumerationSwitch (const char *enum_name, const char *name)
 Adds an enumeration switch. More...
 
int32_t DeleteRangeSwitch (double low)
 Deletes the specified range switch. More...
 
int32_t DeleteEnumerationSwitch (const char *enum_name)
 Deletes the specified enumeration switch. More...
 
int32_t GetRangeSwitches (double **input, uint32_t &array_size)
 Gets the low value for each range switch. More...
 
void GetEnumerationSwitches (StringArray &input)
 Gets the enumeration values for the switch. More...
 
int32_t GetRangeSwitchInfo (double low, double &high, char **name)
 Gets the high value and name for a range switch based on its low value. More...
 
int32_t GetEnumerationInfo (const char *enum_name, char **name)
 Gets the name for a switch based on its enumerated value. More...
 
int32_t Validate ()
 Determines if it is safe to use the switch set. More...
 
const char * GetValidationErrors ()
 Gets a string of the last validation errors. More...
 
uint32_t GetEnumerationInfoLength (const char *enum_name)
 Gets the length for returned info of input parameter. Does not include space for the NULL termination character. More...
 
int32_t GetEnumerationInfo (const char *enum_name, char *name, uint16_t &name_size)
 Gets the name for a switch based on its enumerated value. More...
 
uint32_t GetRangeSwitchInfoLength (double low)
 Gets the length for returned info of input parameter. Does not include space for the NULL termination character. More...
 
int32_t GetRangeSwitchInfo (double low, double &high, char *name, uint16_t &name_size)
 Gets the high value and name for a range switch based on its low value. More...
 
uint32_t GetNumberOfRangeSwitches ()
 Returns the number of range switches available. More...
 
int32_t GetRangeSwitches (double *low_values, uint32_t low_value_size)
 Gets the low value for each range switch. More...
 
void GetItemNames (StringArray &input)
 Retrieves an array of the (e.g., calibrator) names from the set. More...
 
 SwitchSet ()
 Default constructor of the class.
 
 SwitchSet (SwitchSet &input)
 Copy constructor of the class.
 
virtual ~SwitchSet ()
 Class destructor. More...
 
void operator= (SwitchSet &right_side)
 Provides the equal operator.
 
virtual void Init ()
 Initializes the object.
 
- Public Member Functions inherited from trek::NamedItem
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...
 
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.
 
 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.
 

Detailed Description

This class switches limit sets.

The details of switching are defined in SwitchSet. This class limits the type of information that is in the set and provides the serialization of the data.

Constructor & Destructor Documentation

◆ ~LimitAlarmSwitchSet()

trek::LimitAlarmSwitchSet::~LimitAlarmSwitchSet ( )
virtual

Class destructor.

Removes all resources created with this instance of the class.

Member Function Documentation

◆ AddLimitAlarm() [1/2]

int32_t trek::LimitAlarmSwitchSet::AddLimitAlarm ( LimitAlarm input)

Adds a limit alarm.

Adds the limit alarm that can be referenced by a switch. The name of the limit alarm is used for the reference.

Parameters
[in]inputA copy is made for this class.
Returns
SUCCESS
TREK_DATA_NULL_PTR
TREK_DATA_ALREADY_EXISTS

Example:

la.SetLowLimit( 2, -7.0 );
la.SetHighLimit( 2, 34.5 );
ret_value = lass.AddLimitAlarm( la );
This class checks a value for violation of defined limits.
Definition: limit_alarm.h:37
int32_t SetLowLimit(uint32_t level, double value)
Sets the low limit for the specified level.
Definition: limit_alarm.cpp:1393
int32_t SetHighLimit(uint32_t level, double value)
Sets the high limit for the specified level.
Definition: limit_alarm.cpp:1170
This class switches limit sets.
Definition: limit_alarm_switch_set.h:35
int32_t AddLimitAlarm(LimitAlarm *input)
Adds a limit alarm.
Definition: limit_alarm_switch_set.cpp:118

◆ AddLimitAlarm() [2/2]

int32_t trek::LimitAlarmSwitchSet::AddLimitAlarm ( LimitAlarm input)

Adds a limit alarm.

Adds the limit alarm that can be referenced by a switch. The name of the limit alarm is used for the reference.

Parameters
[in]inputA pointer to a valid limit alarm. A copy is made for this class.
Returns
SUCCESS
TREK_DATA_NULL_PTR
TREK_DATA_ALREADY_EXISTS

Example:

la.SetLowLimit( 2, -7.0 );
la.SetHighLimit( 2, 34.5 );
ret_value = lass.AddLimitAlarm( &la );

◆ Check() [1/3]

int32_t trek::LimitAlarmSwitchSet::Check ( double  value,
ParameterStatus status 
)

Checks the input value for alarm violations.

Determines the correct limit alarm to use based on the switching and checks the input value.

Parameters
[in]valueThe value to check.
[out]statusThe status is updated if return is SUCCESS.
Returns
SUCCESS
TREK_DATA_SWITCH_ERROR
other errors
Note
This method is typically only called by internal TReK code. Example:
int ret_value;
ret_value = lass.Check( 1.33, status );
if( ret_value == SUCCESS )
{
printf( "Status string is %s\n", status.GetStatusString() );
}
int32_t Check(double value, ParameterStatus &status)
Checks the input value for alarm violations.
Definition: limit_alarm_switch_set.cpp:267
This class describes the status associated with a parameter value.
Definition: parameter_status.h:104
const char * GetStatusString()
Returns the status as a string.
Definition: parameter_status.cpp:952
#define SUCCESS
The function completed successfully.
Definition: trek_error.h:8

◆ Check() [2/3]

int32_t trek::LimitAlarmSwitchSet::Check ( int64_t  value,
ParameterStatus status 
)

Checks the input value for alarm violations.

Determines the correct limit alarm to use based on the switching and checks the input value.

Parameters
[in]valueThe value to check.
[out]statusThe status is updated if return is SUCCESS.
Returns
SUCCESS
TREK_DATA_SWITCH_ERROR
other errors
Note
This method is typically only called by internal TReK code. Example:
int ret_value;
ret_value = lass.Check( (int64_t)-3, status );
if( ret_value == SUCCESS )
{
printf( "Status string is %s\n", status.GetStatusString() );
}

◆ Check() [3/3]

int32_t trek::LimitAlarmSwitchSet::Check ( uint64_t  value,
ParameterStatus status 
)

Checks the input value for alarm violations.

Determines the correct limit alarm to use based on the switching and checks the input value.

Parameters
[in]valueThe value to check.
[out]statusThe status is updated if return is SUCCESS.
Returns
SUCCESS
TREK_DATA_SWITCH_ERROR
other errors
Note
This method is typically only called by internal TReK code. Example:
int ret_value;
ret_value = lass.Check( (uint64_t)5, status );
if( ret_value == SUCCESS )
{
printf( "Status string is %s\n", status.GetStatusString() );
}

◆ DeleteAllLimitAlarms()

void trek::LimitAlarmSwitchSet::DeleteAllLimitAlarms ( )

Deletes all of the limit alarms.

Example:

la.SetLowLimit( 2, -7.0 );
la.SetHighLimit( 2, 34.5 );
ret_value = lass.AddLimitAlarm( la );
void DeleteAllLimitAlarms()
Deletes all of the limit alarms.
Definition: limit_alarm_switch_set.cpp:212

◆ DeleteLimitAlarm()

int32_t trek::LimitAlarmSwitchSet::DeleteLimitAlarm ( const char *  name)

Deletes the specified limit alarm.

Parameters
[in]nameThe name of the limit alarm to delete.
Returns
SUCCESS
TREK_DATA_NULL_PTR
TREK_DATA_DOES_NOT_EXIST

Example:

la.SetName( "whatever" );
la.SetLowLimit( 2, -7.0 );
la.SetHighLimit( 2, 34.5 );
ret_value = lass.AddLimitAlarm( la );
ret_value = lass.DeleteLimitAlarm( "whatever" );
int32_t DeleteLimitAlarm(const char *name)
Deletes the specified limit alarm.
Definition: limit_alarm_switch_set.cpp:193
void SetName(const char *input_ptr)
Sets the name of the item.
Definition: named_item.cpp:114

◆ GetLimitAlarm()

LimitAlarm * trek::LimitAlarmSwitchSet::GetLimitAlarm ( const char *  name)

Returns the limit alarm with the specified name.

The returned copy is owned by the class. Don't go deleting it.

Parameters
[in]nameThe name of the limit alarm to find.
Returns
A pointer to the limit alarm if found and NULL otherwise.

Example:

LimitAlarm *limit_ptr;
limit_ptr = lass.GetCalibrator( "whatever" );
if( limit_ptr )
{
// safe to use
}

◆ GetLimitAlarmType()

lass_limit_type trek::LimitAlarmSwitchSet::GetLimitAlarmType ( )

Gets the limit type contained in the switch set.

Returns
The limit type.

◆ LoadFile()

int32_t trek::LimitAlarmSwitchSet::LoadFile ( const char *  filename)

Loads the Packet definition from the specified file.

Reads an XML format for the Packet. It can be written in with SaveFile.

Parameters
[in]filenameThe file to load the parameter object from.
Returns
SUCCESS
TREK_DATA_NULL_PTR
Other return codes

Example:

ret_value = lass.LoadFile( "my_file.xml" );
int32_t LoadFile(const char *filename)
Loads the Packet definition from the specified file.
Definition: limit_alarm_switch_set.cpp:371

◆ SaveFile()

int32_t trek::LimitAlarmSwitchSet::SaveFile ( const char *  filename)

Saves the Packet definition to the specified file.

Writes an XML format for the Packet. It can be read in with LoadFile.

Parameters
[in]filenameThe file to save the parameter object to.
Returns
SUCCESS
TREK_DATA_NULL_PTR
Other return codes

Example:

ret_value = lass.SaveFile( "my_file.xml" );
int32_t SaveFile(const char *filename)
Saves the Packet definition to the specified file.
Definition: limit_alarm_switch_set.cpp:405