Pothos  0.2.1-g9f04573d
The Pothos dataflow programming software suite
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros
Public Member Functions | Public Attributes | List of all members
Pothos::Label Class Reference

#include <Label.hpp>

Public Member Functions

 Label (void)
 Create an empty label with null data and zero index. More...
 
template<typename ValueType >
 Label (const std::string &id, ValueType &&data, const unsigned long long index, const size_t width=1)
 Create a label with specified data of ValueType and index. More...
 
template<typename MultType , typename DivType >
Label toAdjusted (const MultType &mult, const DivType &div) const
 
bool operator< (const Label &other) const
 support for sorting Labels by index More...
 
template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 Serialization support. More...
 
template<typename MultType , typename DivType >
Pothos::Label toAdjusted (const MultType &mult, const DivType &div) const
 

Public Attributes

std::string id
 
Object data
 
unsigned long long index
 
size_t width
 

Detailed Description

A Label decorates a stream of information with meta-data. The label's data is an Object with arbitrary contents. The label's index indentifies an element in a stream.

Constructor & Destructor Documentation

Pothos::Label::Label ( void  )

Create an empty label with null data and zero index.

template<typename ValueType >
Pothos::Label::Label ( const std::string &  id,
ValueType &&  data,
const unsigned long long  index,
const size_t  width = 1 
)

Create a label with specified data of ValueType and index.

Member Function Documentation

bool Pothos::Label::operator< ( const Label other) const
inline

support for sorting Labels by index

template<class Archive >
void Pothos::Label::serialize ( Archive &  ar,
const unsigned int  version 
)

Serialization support.

template<typename MultType , typename DivType >
Label Pothos::Label::toAdjusted ( const MultType &  mult,
const DivType &  div 
) const

Create a new label with an adjusted index and width. Example convert bytes to elements: newLbl = lbl.toAdjusted(1, elemSize); Example convert elements to bytes: newLbl = lbl.toAdjusted(elemSize, 1);

Parameters
multa positive multiplier (default 1)
diva positive divider (default 1)
Returns
a copy of this label with an adjusted position
template<typename MultType , typename DivType >
Pothos::Label Pothos::Label::toAdjusted ( const MultType &  mult,
const DivType &  div 
) const

Member Data Documentation

Object Pothos::Label::data

The data can be anything that can be held by Object.

std::string Pothos::Label::id

The identifier describes the label's type, meaning, or purpose. Identifiers only have meaning in the context of the blocks that are producing and consuming them. So any given pair of blocks need to agree on a particular set of identifiers and their meanings.

unsigned long long Pothos::Label::index

The index specifies an offset into a buffer of elements. To associate with the first element of a buffer, index should be 0. To associate with the Nth element of a buffer, index should be N-1.

size_t Pothos::Label::width

The width specifies the number of elements to which this label applies. Width applies to every element from [index to index+width-1] inclusive. The default value of width is 1, and it may not take the value zero.


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