MIRA
Public Types | Public Member Functions | Static Public Attributes | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
GenericTransformer< TNode > Class Template Reference

A generic transformer base class that can be used with different types of actual transformation nodes. More...

#include <transform/Transformer.h>

Inheritance diagram for GenericTransformer< TNode >:
Inheritance graph
[legend]

Public Types

typedef TNode Node
 The type of a transformation node. More...
 
typedef NodeNodePtr
 The type of a pointer of the actual transformation node. More...
 
typedef TransformerBase::AbstractNodePtr AbstractNodePtr
 The type of a pointer to the AbstractTransformerNode base class. More...
 

Public Member Functions

TransformDesc prepareTransform (NodePtr target, NodePtr source)
 Prepares the computation of a transformation by computing the path between the target and source node. More...
 
TransformDesc prepareTransform (NodePtr target, NodePtr source, NodePtr fixed)
 Prepares the computation of a transformation by computing the path between the 'target' and 'source' node via the 'fixed' node, i.e. More...
 
template<typename Transform , typename Filter >
Transform getTransform (const TransformDesc &desc, const Time &targetTime, const Time &sourceTime, Filter &&filter)
 Computes and returns a certain transformation that is specified via the TransformDesc. More...
 
template<typename Transform >
Transform getTransform (const TransformDesc &desc, const Time &targetTime, const Time &sourceTime)
 same as above, but using NearestNeighborInterpolator as filter. More...
 
template<typename Transform , typename Filter >
Transform getTransform (const TransformDesc &desc, const Time &time, Filter &&filter)
 same as above, but with the same time for source and target transform. More...
 
template<typename Transform >
Transform getTransform (const TransformDesc &desc, const Time &time)
 same as above, but using NearestNeighborInterpolator as filter. More...
 
template<typename Transform , typename Filter >
Transform getTransform (NodePtr target, NodePtr source, const Time &time, Filter &&filter)
 Computes and returns a certain transformation between the specified target and source node. More...
 
template<typename Transform >
Transform getTransform (NodePtr target, NodePtr source, const Time &time)
 same as above, but using NearestNeighborInterpolator as filter More...
 
template<typename Transform , typename Filter >
Transform getTransform (NodePtr target, const Time &targetTime, NodePtr source, const Time &sourceTime, NodePtr fixed, Filter &&filter)
 Computes and returns a certain transformation between the specified target and source node via the 'fixed' node, i.e. More...
 
template<typename Transform >
Transform getTransform (NodePtr target, const Time &targetTime, NodePtr source, const Time &sourceTime, NodePtr fixed)
 same as above, but using NearestNeighborInterpolator as filter More...
 
template<typename Transform , typename Filter >
Transform inferTransform (NodePtr node, NodePtr target, NodePtr source, const Transform &transform, const Time &time, Filter &&filter)
 Infers a transform by specifying a direct transform between two nodes, which are connected indirectly over the transformation, that shall be infered. More...
 
template<typename Transform >
Transform inferTransform (NodePtr node, NodePtr target, NodePtr source, const Transform &transform, const Time &time)
 same as above, but using NearestNeighborInterpolator as filter More...
 
NodePtr getNode (const std::string &nodeID)
 Returns a pointer to the node with the given ID or nullptr if it does not exist. 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

template<typename Transform , typename Filter >
Transform getTransform (const Chain &chain, const Time &time, Filter &&filter)
 Computes the resulting transform by applying all transforms according to the specified transform chain. More...
 
void addNode (AbstractNodePtr node)
 An exception that is thrown when errors related to transformations occur. More...
 

Static Protected Member Functions

static NodePtr castNode (AbstractNodePtr node)
 Casts an abstract node pointer to the actual used Node. This is safe. 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

template<typename TNode>
class mira::GenericTransformer< TNode >

A generic transformer base class that can be used with different types of actual transformation nodes.

The used transformation node class must be derived from AbstractTransformerNode. The type of the transformation nodes is passed as template parameter.

Member Typedef Documentation

◆ Node

typedef TNode Node

The type of a transformation node.

◆ NodePtr

typedef Node* NodePtr

The type of a pointer of the actual transformation node.

◆ AbstractNodePtr

The type of a pointer to the AbstractTransformerNode base class.

◆ IDToNodeMap

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

Member Function Documentation

◆ prepareTransform() [1/2]

TransformDesc prepareTransform ( NodePtr  target,
NodePtr  source 
)
inline

Prepares the computation of a transformation by computing the path between the target and source node.

The returned TransformDesc can be used in a call to the getTransform() method.

◆ prepareTransform() [2/2]

TransformDesc prepareTransform ( NodePtr  target,
NodePtr  source,
NodePtr  fixed 
)
inline

Prepares the computation of a transformation by computing the path between the 'target' and 'source' node via the 'fixed' node, i.e.

target->fixed->source. The returned TransformDesc can be used in a call to the getTransform() method.

◆ getTransform() [1/9]

Transform getTransform ( const TransformDesc desc,
const Time targetTime,
const Time sourceTime,
Filter &&  filter 
)
inline

Computes and returns a certain transformation that is specified via the TransformDesc.

Moreover, the timestamps of the transformations is taken into account, therefore the timestamps of the target and source transforms must be specified. Additionally, a filter can be specified that can be used to interpolate or filter the transforms according to the specified timestamps.

◆ getTransform() [2/9]

Transform getTransform ( const TransformDesc desc,
const Time targetTime,
const Time sourceTime 
)
inline

same as above, but using NearestNeighborInterpolator as filter.

◆ getTransform() [3/9]

Transform getTransform ( const TransformDesc desc,
const Time time,
Filter &&  filter 
)
inline

same as above, but with the same time for source and target transform.

◆ getTransform() [4/9]

Transform getTransform ( const TransformDesc desc,
const Time time 
)
inline

same as above, but using NearestNeighborInterpolator as filter.

◆ getTransform() [5/9]

Transform getTransform ( NodePtr  target,
NodePtr  source,
const Time time,
Filter &&  filter 
)
inline

Computes and returns a certain transformation between the specified target and source node.

Moreover, the timestamps of the transformations is taken into account. Additionally, a filter can be specified that can be used to interpolate or filter the transforms according to the specified timestamps.

◆ getTransform() [6/9]

Transform getTransform ( NodePtr  target,
NodePtr  source,
const Time time 
)
inline

same as above, but using NearestNeighborInterpolator as filter

◆ getTransform() [7/9]

Transform getTransform ( NodePtr  target,
const Time targetTime,
NodePtr  source,
const Time sourceTime,
NodePtr  fixed,
Filter &&  filter 
)
inline

Computes and returns a certain transformation between the specified target and source node via the 'fixed' node, i.e.

target->fixed->source. Moreover, the timestamps of the transformations is taken into account, therefore the timestamps of the target and source transforms must be specified. Additionally, a filter can be specified that can be used to interpolate or filter the transforms according to the specified timestamps.

◆ getTransform() [8/9]

Transform getTransform ( NodePtr  target,
const Time targetTime,
NodePtr  source,
const Time sourceTime,
NodePtr  fixed 
)
inline

same as above, but using NearestNeighborInterpolator as filter

◆ inferTransform() [1/2]

Transform inferTransform ( NodePtr  node,
NodePtr  target,
NodePtr  source,
const Transform &  transform,
const Time time,
Filter &&  filter 
)
inline

Infers a transform by specifying a direct transform between two nodes, which are connected indirectly over the transformation, that shall be infered.

Imagine the following example, were the transformation node 'p' is directly connected to the transformation node 'node'. Additionally, both nodes are connected via certain paths with the nodes 'source' and 'target', respectively:

  p ---- x ---- source
  |
  |
  |
  v
  node --- y --- target

Now imagine, you want to compute the transformation between 'p' and 'node', but all you know is the direct transformation between the nodes 'source' and 'target' which are however not directly connected:

  p ---- x ---- source
  |                .
  | ???            . this 'transform'
  |                . is known
  v                v
  node --- y --- target

In this case you can use this method. It computes and returns the desired transform on the link towards 'node' given the 'transform' between the nodes 'target' and 'source' at the specified 'time' and using the specified 'filter' for interpolation.

◆ inferTransform() [2/2]

Transform inferTransform ( NodePtr  node,
NodePtr  target,
NodePtr  source,
const Transform &  transform,
const Time time 
)
inline

same as above, but using NearestNeighborInterpolator as filter

◆ getNode()

NodePtr getNode ( const std::string &  nodeID)
inline

Returns a pointer to the node with the given ID or nullptr if it does not exist.

◆ castNode()

static NodePtr castNode ( AbstractNodePtr  node)
inlinestaticprotected

Casts an abstract node pointer to the actual used Node. This is safe.

◆ getTransform() [9/9]

Transform getTransform ( const Chain chain,
const Time time,
Filter &&  filter 
)
inlineprotected

Computes the resulting transform by applying all transforms according to the specified transform chain.

◆ addLink()

bool addLink ( AbstractNodePtr  child,
AbstractNodePtr  parent 
)
inherited

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 
)
inherited

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 ( )
inherited

Returns all nodes that are known by this transformer.

◆ getLinks()

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

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

◆ getRootNodes()

const std::list<AbstractNodePtr> getRootNodes ( )
inherited

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 
)
inherited
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 
)
inherited

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)
protectedinherited

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

Adds the specified node to the internal node map

Member Data Documentation

◆ MAX_TREE_DEPTH

const int MAX_TREE_DEPTH = 1000
staticinherited

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
protectedinherited

maps from ids to nodes that were added to us

◆ mMutex

boost::mutex mMutex
protectedinherited

protects the above node map


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