Logo
Telescience Resource Kit
TReK Python  5.4.0 ART
DelimitedParameterCollection Class Reference

This class describes a parameter collection composed of one or more parameters. More...

Inherits PacketItem.

Public Member Functions

Initialize / Finalize

Functions handling class initialization and finalization.

def DelimitedParameterCollection ( Optional[DelimitedParameterCollection] param_collection=None -> def ) -> def 
 Class initializer. More...
 
def clone ( -> DelimitedParameterCollection ) -> def 
 Creates a new instance of the object with the same contents.
 
def copy (copy_from: object -> None ) -> def 
 Copies the contents of the provided 'copy_from' DelimitedParameterCollection. More...
 
def initialize ( -> None ) -> def 
 Initializes the object. More...
 
def load_file (filename: str -> None ) -> def 
 Loads the DelimitedParameterCollection definition from the specified file. More...
 
def save_file (filename: str -> None ) -> def 
 Saves the DelimitedParameterCollection definition to the specified file. More...
 
Build and Extract
def calibrate_before_build ( -> None ) -> def 
 Sets all parameters to calibrate prior to building. More...
 
def build (buffer: bytearray -> int ) -> def 
 Builds the parameter collection and places it in the specified buffer. More...
 
def extract (buffer: bytearray, input_length: int -> int ) -> def 
 Extracts all of the parameters in the collection from the specified buffer. More...
 
def find_parameter (name: str -> Parameter ) -> def 
 Finds the specified parameter in the collection. More...
 
def get_delimiter ( -> bytes ) -> def 
 Returns the current delimiter used between parameter values.
 
def get_eol_delimiter ( -> int ) -> def 
 Returns the current character used after all parameters in a packet are written.
 
def get_length_in_bits ( -> int ) -> def 
 Gets the length of the parameter collection in bits. More...
 
def get_length_in_bytes ( -> int ) -> def 
 Gets the length of the parameter collection in bytes. More...
 
def get_maximum_length_in_bits ( -> int ) -> def 
 Returns the maximum length of the DelimitedParameterCollection in bits. More...
 
def get_number_of_parameters ( -> int ) -> def 
 Returns the number of parameters in the collection. More...
 
def get_parameter_list (full_name: bool=True, mod_only: bool=False -> list[str] ) -> def 
 Returns a list of all parameters within a collection. More...
 
def get_sorted_parameter_list (full_name: bool=True, mod_only: bool=False -> list[str] ) -> def 
 Returns a sorted list of all parameters within a collection by their start location. More...
 
def has_modifiable_data (data_zone_only: bool=True -> bool ) -> def 
 Determines if any parameter in the collection is modifiable. More...
 
def has_variable_length_data ( -> bool ) -> def 
 Determines if the parameter collection has any variable length data. More...
 
def insert_parameter (param: Parameter, loc: int -> None ) -> def 
 Adds the parameter to the collection. More...
 
def is_complete ( -> bool ) -> def 
 Determines if all parameters have a value. More...
 
def is_modifiable (top_level: bool=True -> bool ) -> def 
 Determines if any data is modifiable. More...
 
def remove_all_parameters ( -> None ) -> def 
 Removes all parameters and associated memory from the collection.
 
def remove_parameter (name: str -> None ) -> def 
 Removes a parameter from the collection. More...
 
def set_delimiter (delim: bytes -> None ) -> def 
 Sets the character used between parameter values on output. More...
 
def set_eol_delimiter (delim: bytes -> None ) -> def 
 Sets the character used after all parameters in a packet are written. More...
 
Parameters

Functions handling Parameters.

Packet

Functions handling Packets.

- 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 describes a parameter collection composed of one or more parameters.

The ParameterCollection class holds one or more parameters that can be built and placed in a packet based on the start location of each parameter.

Constructor & Destructor Documentation

◆ DelimitedParameterCollection()

(param_collection : Optional[DelimitedParameterCollection]  ) -> def

Class initializer.

Parameters
[in]param_collection(Optional) DelimitedParameterCollection to copy.

Reimplemented from NamedItem.

Member Function Documentation

◆ build()

(buffer : bytearray ) -> int

Builds the parameter collection and places it in the specified buffer.

The parameters composing the collection are built and placed in the buffer.

Returns
The last bit used if successful.
Exceptions
TrekError15021 - TREK_DATA_WILL_NOT_FIT

◆ calibrate_before_build()

() -> None

Sets all parameters to calibrate prior to building.

Typically used for commanding only.

◆ copy()

(copy_from : object ) -> None

Copies the contents of the provided 'copy_from' DelimitedParameterCollection.

Parameters
[in]copy_fromDelimitedParameterCollection to copy from.
Exceptions
TypeErrorif 'copy_from' is not a DelimitedParameterCollection.

Reimplemented from NamedItem.

◆ extract()

(buffer : bytearray 
input_length : int 
) -> int

Extracts all of the parameters in the collection from the specified buffer.

Loops through all of the parameters contained in the collection and extracts their indiviual values (see Parameter for details on what parameter extraction encompasses).

Parameters
bufferThe buffer from which to extract.
input_lengthThe valid number of bits that can be read.
Returns
The last bit used, if successful.
Exceptions
TrekError15062 - TREK_LAST_BIT_ERROR

◆ find_parameter()

(name : str ) -> Parameter

Finds the specified parameter in the collection.

Parameters
[in]nameThe name of the parameter to fine.
Returns
A parameter reference from the collection.
Exceptions
TrekError15007 - TREK_DATA_DOES_NOT_EXIST

Reimplemented from PacketItem.

◆ get_length_in_bits()

() -> int

Gets the length of the parameter collection in bits.

Calculates the length of the parameter collection in bits by determining the last bit used by any parameter in the packet. If the parameter collection contains a variable length parameter, this method will fail.

Returns
Length in bits.
Exceptions
TrekError15017 - TREK_DATA_FIXED_LENGTH_REQUIRED

Reimplemented from PacketItem.

◆ get_length_in_bytes()

() -> int

Gets the length of the parameter collection in bytes.

Calculates the length of the parameter collection in bytes by determining the last bit used by any parameter in the packet. If the parameter collection contains a variable length parameter, this method will fail.

Returns
Length in bytes.
Exceptions
TrekError15017 - TREK_DATA_FIXED_LENGTH_REQUIRED

Reimplemented from PacketItem.

◆ get_maximum_length_in_bits()

() -> int

Returns the maximum length of the DelimitedParameterCollection in bits.

If the DelimitedParameterCollection has variable length data, the actual length may be less than the returned value.

Returns
Maximum length in bits.

Reimplemented from PacketItem.

◆ get_number_of_parameters()

() -> int

Returns the number of parameters in the collection.

Returns
Number of parameters.

◆ get_parameter_list()

(full_name : bool  
mod_only : bool  
) -> list[str]

Returns a list of all parameters within a collection.

Parameters
[in]full_nameTrue, indicates to return parameter fully qualified names.
[in]mod_onlyIndicates if the returned data should be limited to modifiable parameters.
Returns
list[str] containing of all parameters within a collection.

Reimplemented from PacketItem.

◆ get_sorted_parameter_list()

(full_name : bool  
mod_only : bool  
) -> list[str]

Returns a sorted list of all parameters within a collection by their start location.

Parameters
[in]full_nameTrue, indicates to return parameter fully qualified names.
[in]mod_onlyIndicates if the returned data should be limited to modifiable parameters.
Returns
list[str] containing of all parameters sorted by start location.

Reimplemented from PacketItem.

◆ has_modifiable_data()

(data_zone_only : bool  ) -> bool

Determines if any parameter in the collection is modifiable.

Returns
True, if at least one is modifiable.

Reimplemented from PacketItem.

◆ has_variable_length_data()

() -> bool

Determines if the parameter collection has any variable length data.

Returns
True, if parameter has any variable length data.

Reimplemented from PacketItem.

◆ initialize()

() -> None

Initializes the object.

Clears any set values in the DelimitedParameterCollection. New instances do not need to be initialized.

Reimplemented from NamedItem.

◆ insert_parameter()

(param : Parameter 
loc : int 
) -> None

Adds the parameter to the collection.

Adds the parameter to the end of the delimited parameter collection. The DelimitedParameterCollection makes a copy of the input.

Parameters
[in]paramThe parameter to add.
[in]locThe location in the list to add.
Exceptions
TrekError15005 - TREK_DATA_ALREADY_EXISTS

◆ is_complete()

() -> bool

Determines if all parameters have a value.

Returns
If all parameters have a value.

Reimplemented from PacketItem.

◆ is_modifiable()

(top_level : bool  ) -> bool

Determines if any data is modifiable.

Parameters
[in]top_levelDesignates that this is a top level packet.
Returns
True, if at least one is modifiable.

Reimplemented from PacketItem.

◆ load_file()

(filename : str ) -> None

Loads the DelimitedParameterCollection definition from the specified file.

Reads an XML DelimitedParameterCollection.

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

◆ remove_parameter()

(name : str ) -> None

Removes a parameter from the collection.

Parameters
[in]nameThe name of the parameter to remove.
Exceptions
TrekError15007 - TREK_DATA_DOES_NOT_EXIST

◆ save_file()

(filename : str ) -> None

Saves the DelimitedParameterCollection definition to the specified file.

Writes an XML DelimitedParameterCollection.

Parameters
[in]filenameThe file to save the parameter collection object.

◆ set_delimiter()

(delim : bytes ) -> None

Sets the character used between parameter values on output.

Default value is a comma (',').

Parameters
[in]delimThe new delimiter.

◆ set_eol_delimiter()

(delim : bytes ) -> None

Sets the character used after all parameters in a packet are written.

Default value is a new line ('
').

Parameters
[in]delimThe new end-of-line (EOL) delimiter.