Public Member Functions | Private Member Functions | Private Attributes | List of all members
rtctree.node.TreeNode Class Reference

Base node object. More...

Inheritance diagram for rtctree.node.TreeNode:
Inheritance graph
[legend]

Public Member Functions

def __init__ (self, name=None, parent=None, children=None, filter=[], dynamic=False, args, kwargs)
 
def __str__ (self)
 
def add_callback (self, event, cb, args=None)
 
def children (self)
 
def children_names (self)
 
def depth (self)
 
def dynamic (self)
 
def dynamic (self, dynamic)
 
def full_path (self)
 
def full_path_str (self)
 
def get_node (self, path)
 
def has_path (self, path)
 
def is_child (self, other_node)
 
def is_component (self)
 
def is_directory (self)
 
def is_manager (self)
 
def is_nameserver (self)
 
def is_parent (self, other_node)
 
def is_unknown (self)
 
def is_zombie (self)
 
def iterate (self, func, args=None, filter=[])
 
def name (self)
 
def nameserver (self)
 
def orb (self)
 
def parent (self)
 
def parent (self, new_parent)
 
def parent_name (self)
 
def rem_callback (self, event, cb)
 
def remove_child (self, child)
 
def root (self)
 

Private Member Functions

def _add_child (self, new_child)
 
def _call_cb (self, event, value)
 
def _enable_dynamic (self, enable=True)
 
def _remove_all_children (self)
 
def _set_events (self, events)
 

Private Attributes

 _cbs
 
 _children
 
 _dynamic
 
 _mutex
 
 _name
 
 _parent
 

Detailed Description

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.

Definition at line 29 of file node.py.

Constructor & Destructor Documentation

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.

Definition at line 37 of file node.py.

Member Function Documentation

def rtctree.node.TreeNode.__str__ (   self)
Get this node as a string.

Definition at line 61 of file node.py.

def rtctree.node.TreeNode._add_child (   self,
  new_child 
)
private

Definition at line 360 of file node.py.

def rtctree.node.TreeNode._call_cb (   self,
  event,
  value 
)
private

Definition at line 365 of file node.py.

def rtctree.node.TreeNode._enable_dynamic (   self,
  enable = True 
)
private

Definition at line 371 of file node.py.

def rtctree.node.TreeNode._remove_all_children (   self)
private

Definition at line 376 of file node.py.

def rtctree.node.TreeNode._set_events (   self,
  events 
)
private

Definition at line 380 of file node.py.

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.

Definition at line 70 of file node.py.

def rtctree.node.TreeNode.children (   self)
The child nodes of this node (if any).

Definition at line 196 of file node.py.

def rtctree.node.TreeNode.children_names (   self)
A list of the names of the child nodes of this node (if any).

Definition at line 202 of file node.py.

def rtctree.node.TreeNode.depth (   self)
The depth of this node in the tree.

The root node is depth 0.

Definition at line 208 of file node.py.

def rtctree.node.TreeNode.dynamic (   self)
Get and change the dynamic setting of this node.

Definition at line 221 of file node.py.

def rtctree.node.TreeNode.dynamic (   self,
  dynamic 
)

Definition at line 227 of file node.py.

def rtctree.node.TreeNode.full_path (   self)
The full path of this node.

Definition at line 237 of file node.py.

def rtctree.node.TreeNode.full_path_str (   self)
The full path of this node as a string.

Definition at line 246 of file node.py.

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.

Definition at line 89 of file node.py.

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.

Definition at line 110 of file node.py.

def rtctree.node.TreeNode.is_child (   self,
  other_node 
)
Is @ref other_node a child of this node?

Definition at line 132 of file node.py.

def rtctree.node.TreeNode.is_component (   self)
Is this node a component?

Definition at line 258 of file node.py.

def rtctree.node.TreeNode.is_directory (   self)
Is this node a directory?

Definition at line 263 of file node.py.

def rtctree.node.TreeNode.is_manager (   self)
Is this node a manager?

Definition at line 271 of file node.py.

def rtctree.node.TreeNode.is_nameserver (   self)
Is this node a name server (specialisation of directory nodes)?

Definition at line 276 of file node.py.

def rtctree.node.TreeNode.is_parent (   self,
  other_node 
)
Is @ref other_node the parent of this note?

Definition at line 137 of file node.py.

def rtctree.node.TreeNode.is_unknown (   self)
Is this node unknown?

Definition at line 281 of file node.py.

def rtctree.node.TreeNode.is_zombie (   self)
Is this node a zombie?

Definition at line 286 of file node.py.

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.

Definition at line 141 of file node.py.

def rtctree.node.TreeNode.name (   self)
The name of this node.

Definition at line 291 of file node.py.

def rtctree.node.TreeNode.nameserver (   self)
The name server of the node (i.e. its top-most parent below /).

Definition at line 297 of file node.py.

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.

Definition at line 309 of file node.py.

def rtctree.node.TreeNode.parent (   self)
This node's parent, or None if no parent.

Definition at line 322 of file node.py.

def rtctree.node.TreeNode.parent (   self,
  new_parent 
)

Definition at line 335 of file node.py.

def rtctree.node.TreeNode.parent_name (   self)
The name of this node's parent or an empty string if no parent.

Definition at line 343 of file node.py.

def rtctree.node.TreeNode.rem_callback (   self,
  event,
  cb 
)
Remove a callback from this node.

The callback is removed from the specified event.

@param cb The callback function to remove.

Definition at line 180 of file node.py.

def rtctree.node.TreeNode.remove_child (   self,
  child 
)

Definition at line 327 of file node.py.

def rtctree.node.TreeNode.root (   self)
The root node of the tree this node is in.

Definition at line 352 of file node.py.

Member Data Documentation

rtctree.node.TreeNode._cbs
private

Definition at line 56 of file node.py.

rtctree.node.TreeNode._children
private

Definition at line 53 of file node.py.

rtctree.node.TreeNode._dynamic
private

Definition at line 57 of file node.py.

rtctree.node.TreeNode._mutex
private

Definition at line 49 of file node.py.

rtctree.node.TreeNode._name
private

Definition at line 50 of file node.py.

rtctree.node.TreeNode._parent
private

Definition at line 51 of file node.py.


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


rtctree
Author(s): Geoffrey Biggs
autogenerated on Fri Jun 7 2019 21:56:24