Logo
Telescience Resource Kit
TReK Python  5.4.0 ART
RangeEnumerator Class Reference

This class maps unsigned integer values to strings for enumeration. More...

Inherits BaseEnumerator.

Public Member Functions

Initialize / Finalize

Functions handling class initialization and finalization.

def RangeEnumerator ( Optional[RangeEnumerator] enumerator=None, Optional[c_void_p] native_ptr=None, is_clone: bool=False -> def ) -> def 
 Class initializer. More...
 
def __eq__ (enumerator: object -> bool ) -> def 
 Equality operator "==". More...
 
def clone ( -> RangeEnumerator ) -> def 
 Creates and returns an extact copy of the object. More...
 
def copy (copy_from: object -> None ) -> def 
 Copies the contents of the provided 'copy_from' Enumerator. More...
 
def initialize ( -> None ) -> def 
 Initializes the object. More...
 
def load_file (filename: str -> None ) -> def 
 Loads the RangeEnumerator definition from the specified file. More...
 
def save_file (filename: str -> None ) -> def 
 Saves the RangeEnumerator definition to the specified file. More...
 
Enumeration Values

Functions handling enumeration names and values.

def add_enum (int_value: int, str_value: str, end_value: int=0 -> None ) -> def 
 Adds the string values as enumeration for the unsigned integer value. More...
 
def get_number_of_enumerations ( -> int ) -> def 
 Returns the current number of enumerations. More...
 
def get_enum_value (enum_name: str -> int ) -> def 
 Finds the corresponding unsigned integer value for the specified string. More...
 
def get_enum_name (enum_value: int -> str ) -> def 
 Finds the corresponding string value for the specified unsigned integer. More...
 
def get_enum_names ( -> list[str] ) -> def 
 Gets a list of the string enumerations. More...
 
def get_enum_values ( -> list[int] ) -> def 
 Not Implemented for RangeEnumerator. More...
 
def get_enum_ranges ( -> List[EnumeratorRangePoint] ) -> def 
 Gets a list of the begin and end values for which enumerators exist. More...
 
def remove_enum_all ( -> None ) -> def 
 Remove all enumerations. More...
 
def remove_enum_name (enum_name: str -> None ) -> def 
 Removes the enumeration specifed by the string. More...
 
def remove_enum_value (enum_value: int -> None ) -> def 
 Removes the enumeration specifed by the integer. More...
 
Initialize / Finalize

Functions handling class initialization and finalization.

Enumeration Values

Functions handling enumeration names and values.

- 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 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 maps unsigned integer values to strings for enumeration.

The unsigned integer values is limited to 32 bits.

Constructor & Destructor Documentation

◆ RangeEnumerator()

(enumerator : Optional[RangeEnumerator]  
native_ptr : Optional[c_void_p]  
is_clone : bool  
) -> def

Class initializer.

Parameters
[in]enumerator(Optional) The RangeEnumerator to copy construct from.
[in]native_ptr(Optional) Internal parameter, do not provide.
[in]is_clone(Optional) Internal parameter, do not provide.

Reimplemented from NamedItem.

Member Function Documentation

◆ __eq__()

(enumerator : object ) -> bool

Equality operator "==".

if enumerator1 == enumerator2:
print("the content is the same")
Note
Use 'is' operator to compare two variables are the same instance.
Returns
True if contents are equal.

Reimplemented from NamedItem.

◆ add_enum()

(int_value : int 
str_value : str 
end_value : int  
) -> None

Adds the string values as enumeration for the unsigned integer value.

The range enumerator matches if the value is greater than or equal to the begin value and less than or equal to the end value.

Parameters
[in]int_valueThe integer value.
[in]str_valueThe string value.
[in]end_valueThe end value for the enumerator must be >= int_value (begin). Default (0).
Exceptions
TrekError15005 - TREK_DATA_ALREADY_EXISTS,

15042 - TREK_DATA_RANGE_ERROR

Reimplemented from BaseEnumerator.

◆ clone()

Creates and returns an extact copy of the object.

Reimplemented from BaseEnumerator.

◆ copy()

(copy_from : object ) -> None

Copies the contents of the provided 'copy_from' Enumerator.

Parameters
[in]copy_fromEnumerator to copy from.
Exceptions
TrekErrorFAIL if parameter of incorrect type.

Reimplemented from NamedItem.

◆ get_enum_name()

(enum_value : int ) -> str

Finds the corresponding string value for the specified unsigned integer.

Parameters
[in]enum_valueInteger for which to find an enumeration name.
Returns
Name associated with value.
Exceptions
TrekError15007 - TREK_DATA_DOES_NOT_EXIST

Reimplemented from BaseEnumerator.

◆ get_enum_names()

() -> list[str]

Gets a list of the string enumerations.

Deletes any items in the provided array prior to insertion.

Returns
list[str] Returns all string enumerations. It is possible for duplicate strings to be returned. For example, if you used the following ranges 0-1 = RED, 2-3 = BLUE, and 4-7 = RED, then RED will be returned twice.

Reimplemented from BaseEnumerator.

◆ get_enum_ranges()

() -> List[EnumeratorRangePoint]

Gets a list of the begin and end values for which enumerators exist.

For Enumerator, the begin and end values will always be the same.

Returns
list[EnumeratorRangePoint] containing begin, end values.

Reimplemented from BaseEnumerator.

◆ get_enum_value()

(enum_name : str ) -> int

Finds the corresponding unsigned integer value for the specified string.

This function will return the 'begin' for the range.

Parameters
[in]enum_nameEnumeration for which to find a value.
Exceptions
TrekError15007 - TREK_DATA_DOES_NOT_EXIST
Returns
Corresponding value.

Reimplemented from BaseEnumerator.

◆ get_enum_values()

() -> list[int]

Not Implemented for RangeEnumerator.

The RangeEnumerator has a range rather than a single value, use get_enum_ranges().

Exceptions
NotImplementedError,useget_enum_ranges()

Reimplemented from BaseEnumerator.

◆ get_number_of_enumerations()

() -> int

Returns the current number of enumerations.

Returns
Number of enumerations.

Reimplemented from BaseEnumerator.

◆ initialize()

() -> None

Initializes the object.

Reimplemented from NamedItem.

◆ load_file()

(filename : str ) -> None

Loads the RangeEnumerator definition from the specified file.

Reads an XML RangeEnumerator.

Parameters
[in]filenameThe file from which to load the enumerator object.

◆ remove_enum_all()

() -> None

Remove all enumerations.

Reimplemented from BaseEnumerator.

◆ remove_enum_name()

(enum_name : str ) -> None

Removes the enumeration specifed by the string.

Parameters
[in]enum_nameEnumeration name to remove.
Exceptions
TrekError15007 - TREK_DATA_DOES_NOT_EXIST

Reimplemented from BaseEnumerator.

◆ remove_enum_value()

(enum_value : int ) -> None

Removes the enumeration specifed by the integer.

Parameters
[in]enum_valueValue to remove.
Exceptions
TrekError15007 - TREK_DATA_DOES_NOT_EXIST

Reimplemented from BaseEnumerator.

◆ save_file()

(filename : str ) -> None

Saves the RangeEnumerator definition to the specified file.

Writes an XML RangeEnumerator.

Parameters
[in]filenameThe file to save the enumerator object.