pymasep.common.base_object ========================== .. py:module:: pymasep.common.base_object Classes ------- .. autoapisummary:: pymasep.common.base_object.BaseObject Module Contents --------------- .. py:class:: BaseObject(environment, name = None, parent = None, xml_node = None, template=None, src_copy = None) Base class for all functional objects for pymasep that running into an environment. Any BaseObject can be created from template or XML. Name can be omitted if created with XML. :param environment: an Environment instance :param name: name of the BaseObject. :param xml_node: XML used to create the object. :param template: Template of the base object. Needed if no xml_node or src_copy :param parent: parent object (see objects hierarchy) :param src_copy: The BaseObject to copy. Needed if no xml_node or template. The copy is not made into the constructor. :raise pymasep.common.exception.CreationException: If no XML or no template or src_copy is present .. py:attribute:: __slots__ :value: ['environment', 'name', 'nature', 'parent', 'template', '_state', 'initializer'] .. py:attribute:: environment .. py:attribute:: parent parent of the base object (see objects hierarchy) .. py:attribute:: name :type: Optional[str] name of the base object .. py:attribute:: _state :type: Optional[str] :value: None .. py:attribute:: initializer :value: None initializer of the base object .. py:attribute:: template template of the base object .. py:attribute:: nature :type: Optional[str] :value: None nature of the base object .. py:property:: state :type: str State of the BaseObject. None if the object is just created. "Init" if it misses something (input from user) to finish the creation. "Run" is the BaseObject is operational. :return: The state of the BaseObject .. py:method:: id_str() Create a string unique ID of the BaseObject. Depends on the content of the BaseObject. :return: The string unique ID .. py:method:: get_fullname() Return the full name of the base object including the parent name : greatparentname.parentname.name. :return: The full name .. py:method:: to_xml() Transform the BaseObject to XML. See :ref:`serialization` for more information. :return: XML version of the BaseObject .. py:method:: from_xml(environment, xml_node) Transform an XML to a BaseObject. The instance must be created before (with __init__(), passing the xml_node). See :ref:`serialization` for more information. :param environment: The environment where the BaseObject is created. :param xml_node: The XML node containing the BaseObject data. .. py:method:: __str__() Transform the BaseObject to a string of its XML representation. See: ref:`serialization` for more information. :return: A string containing the XML representation of the object. .. py:method:: copy_obs(params) Deep copy the BaseObject to a new instance. Template and initializer stay as the same reference as in the original. :param params: Parameters for the copy of a BaseObject. See each Baseobject for more information. Note : this method copy the reference of the parent. The parent should do the parent copy and assignment.