Logo
Telescience Resource Kit
TReK Python  5.4.0 ART
SwitchSet Class Reference

This class is the abstraction for sets of information that can be switched by the value of a parameter. More...

Inherits NamedItem.

Inherited by CalibratorSwitchSet, EnumeratorSwitchSet, ExpectedStateAlarmSwitchSet, and LimitAlarmSwitchSet.

Public Member Functions

Initialize / Finalize

Functions handling class initialization and finalization.

def SwitchSet ( -> def ) -> def 
 Class initializer. More...
 
def copy (copy_from: object -> None ) -> def 
 Abstract method. More...
 
def initialize ( -> None ) -> def 
 Initializes the object. More...
 
SwitchSet Settings

Functions handling class settings

def set_default_set_name (name: str -> None ) -> def 
 Sets the default set name. More...
 
def get_default_set_name ( -> str ) -> def 
 Gets the default set name. More...
 
def set_switch_parameter_name (par_name: str -> None ) -> def 
 Sets the name of the parameter to use as a switch. More...
 
def get_switch_parameter_name ( -> str ) -> def 
 Gets the switch parameter name. More...
 
def set_switch_type (switch_type: SwitchType -> None ) -> def 
 Sets the type of switch to use. More...
 
def get_switch_type ( -> SwitchType ) -> def 
 Returns the current switch type. More...
 
def get_item_names ( -> list[str] ) -> def 
 Retrieves an array of the (e.g., calibrator) names from the set. More...
 
Enumeration Switch

Functions handling Enumeration Switches.

def add_enumeration_switch (enum_name: str, name: str -> None ) -> def 
 Adds an enumeration switch. More...
 
def get_enumeration_switches ( -> list[str] ) -> def 
 Gets the enumeration values for the switch. More...
 
def get_enumeration_info (enum_name: str -> str ) -> def 
 Gets the name for a switch based on its enumerated value. More...
 
def get_enumeration_info_length (enum_name: str -> int ) -> def 
 Gets the length for returned info of input parameter. More...
 
def delete_enumeration_switch (enum_name: str -> None ) -> def 
 Deletes the specified enumeration switch. More...
 
Range Switch

Functions handling Range Switches.

def add_range_switch (low: float, high: float, name: str -> None ) -> def 
 Adds a range switch. More...
 
def get_range_switches ( -> list[float] ) -> def 
 Gets the low value for each range switch.
 
def get_range_switch_info (low: float -> RangeSwitchInfo ) -> def 
 Gets the high value and name for a range switch based on its low value. More...
 
def get_range_switch_info_length (low: float -> int ) -> def 
 Gets the length for returned info of input parameter. More...
 
def delete_range_switch (low: float -> None ) -> def 
 Deletes the specified range switch. More...
 
Validation

Functions handling set validation.

def validate ( -> int ) -> def 
 Determines if it is safe to use the switched set. More...
 
def get_validation_errors ( -> str ) -> def 
 Gets a string of the last validation errors. More...
 
- Public Member Functions inherited from NamedItem
def remove_all_attributes ( -> None ) -> def 
 Removes all attributes.
 
def remove_attribute (name: str -> None ) -> def 
 Removes the attribute by name. More...
 
def __eq__ (named_item: object -> bool ) -> def 
 Equality operator "==". More...
 
def add_attribute (name: str, value: str -> None ) -> def 
 Adds an attribute to the item. More...
 
def get_alias ( -> str ) -> def 
 Returns the alias of the item. More...
 
def get_attribute (name: str -> str ) -> def 
 Get the value of the specified attribute. More...
 
def get_attribute_list ( -> list[str] ) -> def 
 Gets a list of the attribute names. More...
 
def get_name ( -> str ) -> def 
 Returns the name of the item. More...
 
def get_long_description ( -> str ) -> def 
 Returns the long description of the item. More...
 
def get_short_description ( -> str ) -> def 
 Returns the short description of the item. More...
 
def get_user_description ( -> str ) -> def 
 Returns the user description of the item. More...
 
def get_owner ( -> str ) -> def 
 Returns the owner of the item. More...
 
def get_path ( -> str ) -> def 
 Returns the path for the item. More...
 
def set_name (name: str -> None ) -> def 
 Sets the name of the item. More...
 
def set_alias (alias: str -> None ) -> def 
 Sets the alias of the item. More...
 
def set_short_description (description: str -> None ) -> def 
 Sets the short description of the item. More...
 
def set_long_description (description: str -> None ) -> def 
 Sets the long description of the item. More...
 
def set_user_description (description: str -> None ) -> def 
 Sets the user description of the item. More...
 
def set_owner (owner: str -> None ) -> def 
 Sets the owner of the item. More...
 
def set_path (path: str -> None ) -> def 
 Sets the path of the item. More...
 

Detailed Description

This class is the abstraction for sets of information that can be switched by the value of a parameter.

The switch parameter can be used to determine which set of information to use. Used for enumeration, calbiration, limits, and expected states. Two types of switching are supported: range switching and enumeration switching.

Constructor & Destructor Documentation

◆ SwitchSet()

() -> def

Class initializer.

Reimplemented from NamedItem.

Reimplemented in CalibratorSwitchSet, EnumeratorSwitchSet, ExpectedStateAlarmSwitchSet, and LimitAlarmSwitchSet.

Member Function Documentation

◆ add_enumeration_switch()

(enum_name : str 
name : str 
) -> None

Adds an enumeration switch.

Adds the specified enumeration switch. Checks are performed to make sure the specified enumeration does not already exist.

Parameters
[in]enum_nameThe enumerated value to use for switching.
[in]nameThe name of the item to switch to when the switch parameter has the specified enumeration.
Exceptions
TrekError15110 - TREK_DATA_INCORRECT_SWITCH_TYPE,

15005 - TREK_DATA_ALREADY_EXISTS

◆ add_range_switch()

(low : float 
high : float 
name : str 
) -> None

Adds a range switch.

Adds the specified range switch. Checks are performed to make sure the specified range does not overlap with a current range. Ranges are evaluated by low < value <= high.

Parameters
[in]lowThe low value for the range.
[in]highThe high value for the range.
[in]nameThe name of the item to switch to when the switch parameter fall within range.
Exceptions
TrekError15110 - TREK_DATA_INCORRECT_SWITCH_TYPE,

15111 - TREK_DATA_LOW_TO_HIGH,

15112 - TREK_DATA_NEED_UNIQUE_RANGE

◆ copy()

(copy_from : object ) -> None

Abstract method.

Reimplemented from NamedItem.

Reimplemented in CalibratorSwitchSet, EnumeratorSwitchSet, ExpectedStateAlarmSwitchSet, and LimitAlarmSwitchSet.

◆ delete_enumeration_switch()

(enum_name : str ) -> None

Deletes the specified enumeration switch.

Parameters
[in]enum_nameThe enumerated value to delete.
Exceptions
TrekError15007 - TREK_DATA_DOES_NOT_EXIST

◆ delete_range_switch()

(low : float ) -> None

Deletes the specified range switch.

Only need to specify the low range as ranges are not allowed to overlap.

Parameters
[in]lowThe low range of the switch to delete.
Exceptions
TrekError15007 - TREK_DATA_DOES_NOT_EXIST

◆ get_default_set_name()

() -> str

Gets the default set name.

Returns
The default set name (or empty string).

◆ get_enumeration_info()

(enum_name : str ) -> str

Gets the name for a switch based on its enumerated value.

All of the enumerations can be found by calling GetEnumerationSwitches.

Parameters
[in]enum_nameThe enumerated value to retrieve a switch name.
Returns
The name of the switch.
Exceptions
TrekError15007 - TREK_DATA_DOES_NOT_EXIST

◆ get_enumeration_info_length()

(enum_name : str ) -> int

Gets the length for returned info of input parameter.

If the input does not exist, zero is returned.

Parameters
[in]enum_nameThe enumerated value for which to search.
Returns
Number of bytes needed for info string.

◆ get_enumeration_switches()

() -> list[str]

Gets the enumeration values for the switch.

The input array will be cleared prior to values being added.

Returns
list[str] Will contain all enumerated values for the switch.

◆ get_item_names()

() -> list[str]

Retrieves an array of the (e.g., calibrator) names from the set.

Returns
list[str] List of item names in the SwitchSet.

◆ get_range_switch_info()

(low : float ) -> RangeSwitchInfo

Gets the high value and name for a range switch based on its low value.

All of the low ranges can be found by calling get_range_switches(). The caller of the function is responsible for deleting the memory that is created.

Returns
RangeSwitchInfo
Exceptions
TrekError15007 - TREK_DATA_DOES_NOT_EXIST

◆ get_range_switch_info_length()

(low : float ) -> int

Gets the length for returned info of input parameter.

If the input does not exist, zero is returned.

Parameters
[in]lowThe value for which to search.
Returns
Length of the string in characters.

◆ get_switch_parameter_name()

() -> str

Gets the switch parameter name.

Returns
Switch parameter name.

◆ get_switch_type()

() -> SwitchType

Returns the current switch type.

Returns
The current switch type.

◆ get_validation_errors()

() -> str

Gets a string of the last validation errors.

Returns
The last validation errors.

◆ initialize()

() -> None

Initializes the object.

Clears any set values.

Reimplemented from NamedItem.

◆ set_default_set_name()

(name : str ) -> None

Sets the default set name.

The name of the item (e.g., calibrator) to use if no other set can be identified by switching.

Parameters
[in]nameThe name of the set.

◆ set_switch_parameter_name()

(par_name : str ) -> None

Sets the name of the parameter to use as a switch.

Parameters
[in]par_nameThe name of the switch parameter.

◆ set_switch_type()

(switch_type : SwitchType ) -> None

Sets the type of switch to use.

Parameters
[in]switch_typeThe new switch type.

◆ validate()

() -> int

Determines if it is safe to use the switched set.

Insures that class is properly configured. Safe to use if 0 is returned.

Returns
The number of errors found.