carputils
Doxygen code documentation for the python framework controlling openCARP
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
carputils.cml.cmltree.CMLLeaf Class Reference

Class defining a leaf object. More...

Inheritance diagram for carputils.cml.cmltree.CMLLeaf:
carputils.cml.cmltree.CMLNode

Public Member Functions

def __init__ (self, parent, key, value)
 Method to initialize a CMLLeaf object. More...
 
def add_child (self, node)
 Add child node. More...
 
def serialize (self)
 Serialize node and all child nodes. More...
 
def objectify (self)
 Objectify node and all child nodes. More...
 
- Public Member Functions inherited from carputils.cml.cmltree.CMLNode
def __init__ (self, parent, key)
 Method to initialize a CMLNode object. More...
 
def add_child (self, node)
 Add child node. More...
 
def serialize (self)
 Serialize node and all child nodes. More...
 
def objectify (self)
 Objectify node and all child nodes. More...
 

Static Public Member Functions

def from_node (node, value)
 Method to create a CMLLeaf object. More...
 

Public Attributes

 value
 
- Public Attributes inherited from carputils.cml.cmltree.CMLNode
 parent
 parent node More...
 
 level
 level of the node More...
 
 index
 index of the node in the parent's child collection More...
 
 key
 key of the node (string or None) More...
 

Additional Inherited Members

- Properties inherited from carputils.cml.cmltree.CMLNode
 has_key = property
 Check if the CML-Node has a valid key. More...
 

Detailed Description

Class defining a leaf object.

CMLLeafs are nodes to which a value is assigned to. CMLLeafs can not have child CMLNodes.

Constructor & Destructor Documentation

◆ __init__()

def carputils.cml.cmltree.CMLLeaf.__init__ (   self,
  parent,
  key,
  value 
)

Method to initialize a CMLLeaf object.

Parameters
parentParent node
keyKey string or None
valueValue assigned to the leaf

Member Function Documentation

◆ add_child()

def carputils.cml.cmltree.CMLLeaf.add_child (   self,
  node 
)

Add child node.

Note
This is just a method interface, a NotImplementedError will be raised when the method is called.
Parameters
nodechild node
Exceptions
NotImplementedError

◆ from_node()

def carputils.cml.cmltree.CMLLeaf.from_node (   node,
  value 
)
static

Method to create a CMLLeaf object.

A CMLLeaf object is created from a CMLNode object.

Parameters
nodePlaceholder node
valueValue assigned to the leaf
Exceptions
AttributeErrorif node is not an instance of CMLNode
Returns
The CMLLeaf object created

◆ objectify()

def carputils.cml.cmltree.CMLLeaf.objectify (   self)

Objectify node and all child nodes.

Returns
If the key of the node is None, the value assigned to the node is returned, else a list containing the key and the value is returned

◆ serialize()

def carputils.cml.cmltree.CMLLeaf.serialize (   self)

Serialize node and all child nodes.

Returns
If the key of the node is None, the value assigned to the node is returned, else a list containing the key and the value is returned

Member Data Documentation

◆ value

carputils.cml.cmltree.CMLLeaf.value

The documentation for this class was generated from the following file: