The Volatility Framework
volatility.renderers.TreeGrid Class Reference

Class providing the interface for a TreeGrid (which contains TreeNodes) More...

Inheritance diagram for volatility.renderers.TreeGrid:

Public Member Functions

def __init__ (self, columns, generator)
 Constructs a TreeGrid object using a specific set of columns. More...
 
def populate
 Generator that returns the next available Node. More...
 
def populated (self)
 Indicates that population has completed and the tree may now be manipulated separately.
 
def columns (self)
 Returns the available columns and their ordering and types.
 
def children (self, node)
 Returns the subnodes of a particular node in order.
 
def values (self, node)
 Returns the values for a particular node. More...
 
def is_ancestor (self, node, descendant)
 Returns true if descendent is a child, grandchild, etc of node.
 
def path_depth (self, node)
 Returns the path depth of a particular node.
 
def max_depth (self)
 Returns the maximum depth of the tree.
 
def path_is_valid (self, node)
 Returns True is a given path is valid for this treegrid.
 
def visit
 Visits all the nodes in a tree, calling function on each one. More...
 

Public Attributes

 RowStructure
 

Static Public Attributes

tuple simple_types = set([int, long, str, float, bytes])
 
string path_sep = "|"
 

Detailed Description

Class providing the interface for a TreeGrid (which contains TreeNodes)

The structure of a TreeGrid is designed to maintain the structure of the tree in a single object. For this reason each TreeNode does not hold its children, they are managed by the top level object. This leaves the Nodes as simple data carries and prevents them being used to manipulate the tree as a whole. This is a data structure, and is not expected to be modified much once created.

Carrying the children under the parent makes recursion easier, but then every node is its own little tree and must have all the supporting tree functions. It also allows for a node to be present in several different trees, and to create cycles.

Constructor & Destructor Documentation

def volatility.renderers.TreeGrid.__init__ (   self,
  columns,
  generator 
)

Constructs a TreeGrid object using a specific set of columns.

The TreeGrid itself is a root element, that can have children but no values. The TreeGrid does not contain any information about formatting, these are up to the renderers and plugins.

:param columns: A list of column tuples made up of (name, type). :param generator: A generator that populates the tree/grid structure

Member Function Documentation

def volatility.renderers.TreeGrid.populate (   self,
  func = None,
  initial_accumulator = None 
)

Generator that returns the next available Node.

This is equivalent to a one-time visit.

def volatility.renderers.TreeGrid.values (   self,
  node 
)

Returns the values for a particular node.

The values returned are mutable,

def volatility.renderers.TreeGrid.visit (   self,
  node,
  function,
  initial_accumulator = None,
  sort_key = None 
)

Visits all the nodes in a tree, calling function on each one.

function should have the signature function(node, accumulator) and return new_accumulator If accumulators are not needed, the function must still accept a second parameter.

The order of that the nodes are visited is always depth first, however, the order children are traversed can be set based on a sort_key function which should accept a node's values and return something that can be sorted to receive the desired order (similar to the sort/sorted key).

We use the private _find_children function so that we don't have to re-traverse the tree for every node we descend further down


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