Public Member Functions | Private Member Functions | Private Attributes
rtctree.node.TreeNode Class Reference

Base node object. More...

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

List of all members.

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

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 36 of file node.py.


Member Function Documentation

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]

Reimplemented in rtctree.component.Component.

Definition at line 371 of file node.py.

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.

The child nodes of this node (if any).

Definition at line 196 of file node.py.

A list of the names of the child nodes of this node (if any).

Definition at line 202 of file node.py.

The depth of this node in the tree.

The root node is depth 0.

Definition at line 208 of file node.py.

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.

The full path of this node.

Definition at line 237 of file node.py.

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.

Is this node a component?

Reimplemented in rtctree.component.Component.

Definition at line 258 of file node.py.

Is this node a directory?

Reimplemented in rtctree.manager.Manager, and rtctree.directory.Directory.

Definition at line 263 of file node.py.

Is this node a manager?

Reimplemented in rtctree.manager.Manager.

Definition at line 271 of file node.py.

Is this node a name server (specialisation of directory nodes)?

Reimplemented in rtctree.nameserver.NameServer.

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.

Is this node unknown?

Reimplemented in rtctree.unknown.Unknown.

Definition at line 281 of file node.py.

Is this node a zombie?

Reimplemented in rtctree.zombie.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.

The name of this node.

Definition at line 291 of file node.py.

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.

Reimplemented in rtctree.nameserver.NameServer.

Definition at line 309 of file node.py.

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.

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.

The root node of the tree this node is in.

Definition at line 352 of file node.py.


Member Data Documentation

Definition at line 45 of file node.py.

Definition at line 45 of file node.py.

Reimplemented in rtctree.component.Component.

Definition at line 45 of file node.py.

Definition at line 45 of file node.py.

Definition at line 45 of file node.py.

Definition at line 45 of file node.py.


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


rtctree
Author(s): Geoffrey Biggs
autogenerated on Wed Aug 26 2015 16:13:08