MIRA
Classes | Public Types | Public Member Functions | Static Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | List of all members
TransformerBase Class Reference

Base class for Transformer to decouple base functionality that is type independent from type dependent Transformer class template. More...

#include <transform/Transformer.h>

Inheritance diagram for TransformerBase:
Inheritance graph
[legend]

Classes

class  Chain
 Represents a chain or path through the transformation tree from a staring node to the target node containing nodes whose transforms need to be applied inverse and nodes whose transforms need to be applied forward. More...
 

Public Types

typedef AbstractTransformerNode::AbstractNodePtr AbstractNodePtr
 Injects the AbstractTransformerNode::AbstractNodePtr type. More...
 

Public Member Functions

 TransformerBase ()
 The default construtor. More...
 
 ~TransformerBase ()
 The destructor. More...
 
bool addLink (AbstractNodePtr child, AbstractNodePtr parent)
 Adds a link between the specified child and its parent. More...
 
void removeLink (AbstractNodePtr child, AbstractNodePtr parent)
 Removes an existing link between the specified child node and the given parent node. More...
 
std::list< AbstractNodePtrgetNodes ()
 Returns all nodes that are known by this transformer. More...
 
std::list< std::pair< AbstractNodePtr, AbstractNodePtr > > getLinks ()
 Returns all links (as parent,child-pairs) that are known by this transformer. More...
 
const std::list< AbstractNodePtrgetRootNodes ()
 Returns a list of all nodes, that have no ancestor, e.g. More...
 
void getTransformChain (AbstractNodePtr target, AbstractNodePtr source, Chain &oChain)
 
bool isTransformAvailable (AbstractNodePtr target, AbstractNodePtr source)
 Checks if a transformation between 'target' and 'source' node is available: More...
 

Static Public Attributes

static const int MAX_TREE_DEPTH = 1000
 The max. More...
 

Protected Types

typedef std::map< std::string, AbstractNodePtrIDToNodeMap
 

Protected Member Functions

void addNode (AbstractNodePtr node)
 An exception that is thrown when errors related to transformations occur. More...
 
AbstractNodePtr getNode (const std::string &nodeID)
 Returns the node with the specified id, or nullptr if such a node does not exist. More...
 

Protected Attributes

IDToNodeMap mNodes
 maps from ids to nodes that were added to us More...
 
boost::mutex mMutex
 protects the above node map More...
 

Detailed Description

Base class for Transformer to decouple base functionality that is type independent from type dependent Transformer class template.

Member Typedef Documentation

◆ AbstractNodePtr

◆ IDToNodeMap

typedef std::map<std::string, AbstractNodePtr> IDToNodeMap
protected

Constructor & Destructor Documentation

◆ TransformerBase()

The default construtor.

◆ ~TransformerBase()

The destructor.

Member Function Documentation

◆ addLink()

bool addLink ( AbstractNodePtr  child,
AbstractNodePtr  parent 
)

Adds a link between the specified child and its parent.

Both nodes must have been added to this Transformer. If both nodes are connected to each other already this method has no effect. If the child was connected to another parent before it is unlinked from its current parent first and then linked to the new one. Returns true, if the link was new. If the link was already known, false is returned.

◆ removeLink()

void removeLink ( AbstractNodePtr  child,
AbstractNodePtr  parent 
)

Removes an existing link between the specified child node and the given parent node.

If both nodes are not connected, this method does nothing.

◆ getNodes()

std::list<AbstractNodePtr> getNodes ( )

Returns all nodes that are known by this transformer.

◆ getLinks()

std::list<std::pair<AbstractNodePtr, AbstractNodePtr> > getLinks ( )

Returns all links (as parent,child-pairs) that are known by this transformer.

◆ getRootNodes()

const std::list<AbstractNodePtr> getRootNodes ( )

Returns a list of all nodes, that have no ancestor, e.g.

that are root nodes of a transform tree.

◆ getTransformChain()

void getTransformChain ( AbstractNodePtr  target,
AbstractNodePtr  source,
Chain oChain 
)
Exceptions
ThrowsXTransform, if source and target are not connected or if there is a loop in the transform tree.

◆ isTransformAvailable()

bool isTransformAvailable ( AbstractNodePtr  target,
AbstractNodePtr  source 
)

Checks if a transformation between 'target' and 'source' node is available:

  • Is a path between 'target' and 'source' available
  • Does every Node along the path contain data

◆ addNode()

void addNode ( AbstractNodePtr  node)
protected

An exception that is thrown when errors related to transformations occur.

Adds the specified node to the internal node map

◆ getNode()

AbstractNodePtr getNode ( const std::string &  nodeID)
protected

Returns the node with the specified id, or nullptr if such a node does not exist.

Member Data Documentation

◆ MAX_TREE_DEPTH

const int MAX_TREE_DEPTH = 1000
static

The max.

allowed number of levels within a transformation tree. It is used by collectNodesUpwardsToRoot() that is applied to find the "lowest common ancestor" in getTransformChain() to detect loops within the transformation tree.

◆ mNodes

IDToNodeMap mNodes
protected

maps from ids to nodes that were added to us

◆ mMutex

boost::mutex mMutex
protected

protects the above node map


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