pymasep.common.characteristic
Classes
Object to handle characteristic of an Object |
Module Contents
- class pymasep.common.characteristic.Characteristic(environment, name=None, parent=None, xml_node=None, template=None, src_copy=None)
Bases:
pymasep.common.BaseObjectObject to handle characteristic of an Object
- Parameters:
environment – an Environment instance
name (str) – name of the BaseObject.
xml_node (Optional[xml.etree.ElementTree.Element]) – XML used to create the object.
template – Template of the base object. Needed if no xml_node. If the template is present, must include a value_type (see Templates)
parent (Optional[pymasep.common.BaseObject]) – parent object (see objects hierarchy)
src_copy (Optional[Characteristic]) – Characteristic to copy. See copy_obs()
- Raises:
pymasep.common.exception.CreationException – If no XML or no template is present
- _value: Any = None
- value_type: type
type of the characteristic value
- property value: Any
Value of the characteristic. The type is defined in self.value_type
- Returns:
The value of the characteristic
- Return type:
Any
- id_str()
Create a string unique ID of the Characteristic. Depends on the content of the BaseObject and the value of the Characteristic
- Returns:
The string unique ID
- Return type:
str
- to_xml()
Transform the Characteristic to XML. See Serialization for more information.
- Returns:
XML version of the Characteristic
- Return type:
xml.etree.ElementTree.Element
- from_xml(environment, xml_node)
Transform an XML to a Characteristic. The instance must be created before (with __init__(), passing the xml_node). See Serialization for more information.
- Parameters:
environment – The environment where the BaseObject is created.
xml_node (xml.etree.ElementTree.Element) – The XML node that contains Characteristic data.
- Raises:
pymasep.common.exception.CreationException – Initializer or SubElement must be present. If state is ‘init’, the initializer must be an Interface Initializer if state is ‘init’, SubElement value must be None. If state is ‘run’, no template or initializer is allowed.
- Return type:
None
- copy_obs(params)
Deep copy the Characteristic to a new instance.
- Parameters:
params (dict) – Not used for a Characteristic
Note : this method copy the reference of the parent. The parent should do the parent copy and assignment