transformer
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
transformer::Transformer Class Reference

#include <Transformer.hpp>

Inheritance diagram for transformer::Transformer:
transformer::NonAligningTransformer

Public Member Functions

 Transformer (int priority=-10)
 
virtual void clear ()
 
void addTransformationChain (std::string from, std::string to, const std::vector< TransformationElement *> &chain)
 
TransformationregisterTransformation (std::string sourceFrame, std::string targetFrame)
 
const std::vector< Transformation * > & getRegisteredTransformations ()
 
void unregisterTransformation (Transformation *transformation)
 
void registerTransformCallback (Transformation &transform, boost::function< void(const base::Time &ts, const Transformation &t)> callback)
 
template<class T >
int registerDataStream (base::Time dataPeriod, boost::function< void(const base::Time &ts, const T &value)> callback, int priority=-1, const std::string &name=std::string())
 
template<class T >
int registerDataStreamWithTransform (base::Time dataPeriod, Transformation &transformation, boost::function< void(const base::Time &ts, const T &value, const Transformation &t)> callback, int priority=- 1, const std::string &name=std::string())
 
void unregisterDataStream (int idx)
 
void disableStream (int idx)
 
void enableStream (int idx)
 
bool isStreamActive (int idx) const
 
void requestTransformationAtTime (int idx, base::Time ts)
 
template<class T >
void pushData (int idx, const base::Time &ts, const T &data)
 
int step ()
 
const aggregator::StreamAlignerStatus & getStreamAlignerStatus ()
 
void setTimeout (const base::Time &t)
 
virtual void pushDynamicTransformation (const TransformationType &tr)
 
void pushStaticTransformation (const TransformationType &tr)
 
void setFrameMapping (const std::string &frameName, const std::string &newName)
 
const aggregator::StreamAlignerStatus & getStatus ()
 
const TransformerStatusgetTransformerStatus ()
 
virtual ~Transformer ()
 

Protected Member Functions

void recomputeAvailableTransformations ()
 

Protected Attributes

aggregator::StreamAligner aggregator
 
std::map< std::pair< std::string, std::string >, int > transformToStreamIndex
 
std::vector< Transformation * > transformations
 
TransformationTree transformationTree
 
int priority
 
TransformerStatus transformerStatus
 

Detailed Description

A class that provides transformations to given samples, ordered in time.

Constructor & Destructor Documentation

◆ Transformer()

transformer::Transformer::Transformer ( int  priority = -10)
inline

Default constructor for a transformer

Parameters
priority- stream priority which is given to dynamic transform streams.

◆ ~Transformer()

transformer::Transformer::~Transformer ( )
virtual

Destructor, deletes the TransformationMakers

Member Function Documentation

◆ addTransformationChain()

void transformer::Transformer::addTransformationChain ( std::string  from,
std::string  to,
const std::vector< TransformationElement *> &  chain 
)

This function may be used to manually set a transformation chain.

The function seeks through all registered sample streams, and sets the given chain to those streams, where the source and target frame matches.

◆ clear()

void transformer::Transformer::clear ( )
virtual

Deletes all dynamic and static transformations that are known to the transformer.

Also deletes all samples in the data streams

Callbacks and setups for the data streams are NOT deleted by this method.

Reimplemented in transformer::NonAligningTransformer.

◆ disableStream()

void transformer::Transformer::disableStream ( int  idx)
inline

◆ enableStream()

void transformer::Transformer::enableStream ( int  idx)
inline

◆ getRegisteredTransformations()

const std::vector<Transformation *>& transformer::Transformer::getRegisteredTransformations ( )
inline

Returns a vector of the registered transformations.

◆ getStatus()

const aggregator::StreamAlignerStatus& transformer::Transformer::getStatus ( )
inline
Returns
the status of the StreamAligner, which contains current latency and buffer fill sizes of the individual streams.

◆ getStreamAlignerStatus()

const aggregator::StreamAlignerStatus& transformer::Transformer::getStreamAlignerStatus ( )
inline

Get debug output of underlying stream aligner

◆ getTransformerStatus()

const TransformerStatus & transformer::Transformer::getTransformerStatus ( )
Returns
the status of the transformer

◆ isStreamActive()

bool transformer::Transformer::isStreamActive ( int  idx) const
inline

◆ pushData()

template<class T >
void transformer::Transformer::pushData ( int  idx,
const base::Time &  ts,
const T &  data 
)
inline

Push new data into the stream

Parameters
ts- the timestamp of the data item
data- the data added to the stream

◆ pushDynamicTransformation()

void transformer::Transformer::pushDynamicTransformation ( const TransformationType tr)
virtual

Function for adding new Transformation samples.

This function will interally keep track of available transformations and register streams for 'new' transformations.

Reimplemented in transformer::NonAligningTransformer.

◆ pushStaticTransformation()

void transformer::Transformer::pushStaticTransformation ( const TransformationType tr)

Function for adding static Transformations.

◆ recomputeAvailableTransformations()

void transformer::Transformer::recomputeAvailableTransformations ( )
protected

◆ registerDataStream()

template<class T >
int transformer::Transformer::registerDataStream ( base::Time  dataPeriod,
boost::function< void(const base::Time &ts, const T &value)>  callback,
int  priority = -1,
const std::string &  name = std::string() 
)
inline

This function registes a new data stream together with an callback.

The callback will be called every time a new data sample is available.

◆ registerDataStreamWithTransform()

template<class T >
int transformer::Transformer::registerDataStreamWithTransform ( base::Time  dataPeriod,
Transformation transformation,
boost::function< void(const base::Time &ts, const T &value, const Transformation &t)>  callback,
int  priority = - 1,
const std::string &  name = std::string() 
)
inline

This function registes a new data stream together with an callback.

The callback will be called every time a new data sample is available.

◆ registerTransformation()

Transformation & transformer::Transformer::registerTransformation ( std::string  sourceFrame,
std::string  targetFrame 
)

This function registers a wanted transformation at the transformation stack.

It returns a reference to an object that represents the wanted transformation.

Note, the time of the transformation advances if one calls step() on the transformer.

◆ registerTransformCallback()

void transformer::Transformer::registerTransformCallback ( Transformation transform,
boost::function< void(const base::Time &ts, const Transformation &t)>  callback 
)
inline

Registers a callback that will be called every time a new transformation is available for the given Transformation handle.

◆ requestTransformationAtTime()

void transformer::Transformer::requestTransformationAtTime ( int  idx,
base::Time  ts 
)
inline

◆ setFrameMapping()

void transformer::Transformer::setFrameMapping ( const std::string &  frameName,
const std::string &  newName 
)

◆ setTimeout()

void transformer::Transformer::setTimeout ( const base::Time &  t)
inline

◆ step()

int transformer::Transformer::step ( )
inline

Process data streams, this basically calls StreamAligner::step().

◆ unregisterDataStream()

void transformer::Transformer::unregisterDataStream ( int  idx)
inline

This function unregistes a data stream.

◆ unregisterTransformation()

void transformer::Transformer::unregisterTransformation ( Transformation transformation)

Unregisteres a transformation from the transfromation stack.

This removes and deletes the given transformation

Member Data Documentation

◆ aggregator

aggregator::StreamAligner transformer::Transformer::aggregator
protected

◆ priority

int transformer::Transformer::priority
protected

◆ transformations

std::vector<Transformation *> transformer::Transformer::transformations
protected

◆ transformationTree

TransformationTree transformer::Transformer::transformationTree
protected

◆ transformerStatus

TransformerStatus transformer::Transformer::transformerStatus
protected

◆ transformToStreamIndex

std::map<std::pair<std::string, std::string>, int> transformer::Transformer::transformToStreamIndex
protected

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