Base node object. More...

Public Member Functions | |
| def | __init__ |
| def | __str__ |
| def | add_callback |
| def | children |
| def | children_names |
| def | depth |
| def | dynamic |
| def | dynamic |
| def | full_path |
| def | full_path_str |
| def | get_node |
| def | has_path |
| def | is_child |
| def | is_component |
| def | is_directory |
| def | is_manager |
| def | is_nameserver |
| def | is_parent |
| def | is_unknown |
| def | is_zombie |
| def | iterate |
| def | name |
| def | nameserver |
| def | orb |
| def | parent |
| def | parent |
| def | parent_name |
| def | rem_callback |
| def | remove_child |
| def | root |
Private Member Functions | |
| def | _add_child |
| def | _call_cb |
| def | _enable_dynamic |
| def | _remove_all_children |
| def | _set_events |
Private Attributes | |
| _cbs | |
| _children | |
| _dynamic | |
| _mutex | |
| _name | |
| _parent | |
Base node object.
Base class for a node in the tree. Do not create this class directly. Create objects using a suitable child class of this class.
| def rtctree.node.TreeNode.__init__ | ( | self, | |
name = None, |
|||
parent = None, |
|||
children = None, |
|||
filter = [], |
|||
dynamic = False, |
|||
| args, | |||
| kwargs | |||
| ) |
Constructor.
@param name Name of this node (i.e. its entry in the path).
@param parent The parent node of this node, if any.
@param children If the list of children is already known, put it here.
@param filter A list of paths to filter by.
@param dynamic Enable dynamic features such as observers on this node
and any children it creates.
| def rtctree.node.TreeNode.__str__ | ( | self | ) |
| def rtctree.node.TreeNode._add_child | ( | self, | |
| new_child | |||
| ) | [private] |
| def rtctree.node.TreeNode._call_cb | ( | self, | |
| event, | |||
| value | |||
| ) | [private] |
| def rtctree.node.TreeNode._enable_dynamic | ( | self, | |
enable = True |
|||
| ) | [private] |
Reimplemented in rtctree.component.Component.
| def rtctree.node.TreeNode._remove_all_children | ( | self | ) | [private] |
| def rtctree.node.TreeNode._set_events | ( | self, | |
| events | |||
| ) | [private] |
| def rtctree.node.TreeNode.add_callback | ( | self, | |
| event, | |||
| cb, | |||
args = None |
|||
| ) |
Add a callback to this node. Callbacks are called when the specified event occurs. The available events depends on the specific node type. Args should be a value to pass to the callback when it is called. The callback should be of the format: def callback(node, value, cb_args): where node will be the node that called the function, value is the relevant information for the event, and cb_args are the arguments you registered with the callback.
| def rtctree.node.TreeNode.children | ( | self | ) |
| def rtctree.node.TreeNode.children_names | ( | self | ) |
| def rtctree.node.TreeNode.depth | ( | self | ) |
| def rtctree.node.TreeNode.dynamic | ( | self | ) |
| def rtctree.node.TreeNode.dynamic | ( | self, | |
| dynamic | |||
| ) |
| def rtctree.node.TreeNode.full_path | ( | self | ) |
| def rtctree.node.TreeNode.full_path_str | ( | self | ) |
| def rtctree.node.TreeNode.get_node | ( | self, | |
| path | |||
| ) |
Get a child node of this node, or this node, based on a path.
@param path A list of path elements pointing to a node in the tree.
For example, ['/', 'localhost', 'dir.host']. The first
element in this path should be this node's name.
@return The node pointed to by @ref path, or None if the path does not
point to a node in the tree below this node.
| def rtctree.node.TreeNode.has_path | ( | self, | |
| path | |||
| ) |
Check if a path exists below this node.
@param path A list of path elements pointing to a node in the tree.
For example, ['/', 'localhost', 'dir.host']. The first
element in this path should be this node's name.
@return True if the path points to a node in the tree below this node,
or this node itself (for paths one element long). False
otherwise.
| def rtctree.node.TreeNode.is_child | ( | self, | |
| other_node | |||
| ) |
| def rtctree.node.TreeNode.is_component | ( | self | ) |
Is this node a component?
Reimplemented in rtctree.component.Component.
| def rtctree.node.TreeNode.is_directory | ( | self | ) |
Is this node a directory?
Reimplemented in rtctree.manager.Manager, and rtctree.directory.Directory.
| def rtctree.node.TreeNode.is_manager | ( | self | ) |
Is this node a manager?
Reimplemented in rtctree.manager.Manager.
| def rtctree.node.TreeNode.is_nameserver | ( | self | ) |
Is this node a name server (specialisation of directory nodes)?
Reimplemented in rtctree.nameserver.NameServer.
| def rtctree.node.TreeNode.is_parent | ( | self, | |
| other_node | |||
| ) |
| def rtctree.node.TreeNode.is_unknown | ( | self | ) |
Is this node unknown?
Reimplemented in rtctree.unknown.Unknown.
| def rtctree.node.TreeNode.is_zombie | ( | self | ) |
Is this node a zombie?
Reimplemented in rtctree.zombie.Zombie.
| def rtctree.node.TreeNode.iterate | ( | self, | |
| func, | |||
args = None, |
|||
filter = [] |
|||
| ) |
Call a function on this node, and recursively all its children.
This is a depth-first iteration.
@param func The function to call. Its declaration must be
'def blag(node, args)', where 'node' is the current node
in the iteration and args is the value of @ref args.
@param args Extra arguments to pass to the function at each iteration.
Pass multiple arguments in as a tuple.
@param filter A list of filters to apply before calling func for each
node in the iteration. If the filter is not True,
@ref func will not be called for that node. Each filter
entry should be a string, representing one of the is_*
properties (is_component, etc), or a function object.
@return The results of the calls to @ref func in a list.
| def rtctree.node.TreeNode.name | ( | self | ) |
| def rtctree.node.TreeNode.nameserver | ( | self | ) |
| def rtctree.node.TreeNode.orb | ( | self | ) |
The ORB used to access this object. This property's value will be None if no object above this object is a name server.
Reimplemented in rtctree.nameserver.NameServer.
| def rtctree.node.TreeNode.parent | ( | self | ) |
| def rtctree.node.TreeNode.parent | ( | self, | |
| new_parent | |||
| ) |
| def rtctree.node.TreeNode.parent_name | ( | self | ) |
| def rtctree.node.TreeNode.rem_callback | ( | self, | |
| event, | |||
| cb | |||
| ) |
| def rtctree.node.TreeNode.remove_child | ( | self, | |
| child | |||
| ) |
| def rtctree.node.TreeNode.root | ( | self | ) |
rtctree::node.TreeNode::_cbs [private] |
rtctree::node.TreeNode::_children [private] |
rtctree::node.TreeNode::_dynamic [private] |
Reimplemented in rtctree.component.Component.
rtctree::node.TreeNode::_mutex [private] |
rtctree::node.TreeNode::_name [private] |
rtctree::node.TreeNode::_parent [private] |