Pothos  0.7.0-gf7fbae99
The Pothos dataflow programming software suite
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
 
template<typename MultType , typename DivType >
Labeladjust (const MultType &mult, const DivType &div)
 
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
 
template<typename MultType , typename DivType >
Pothos::Labeladjust (const MultType &mult, const DivType &div)
 

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

◆ Label() [1/2]

Pothos::Label::Label ( void  )

Create an empty label with null data and zero index.

◆ Label() [2/2]

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

◆ adjust() [1/2]

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

Adjust the index and width based on a multiplier/divider.

Parameters
multa positive multiplier (default 1)
diva positive divider (default 1)
Returns
a reference to this label

◆ adjust() [2/2]

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

◆ operator<()

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

support for sorting Labels by index

◆ serialize()

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

Serialization support.

◆ toAdjusted() [1/2]

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

◆ toAdjusted() [2/2]

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

Member Data Documentation

◆ data

Object Pothos::Label::data

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

◆ id

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.

◆ index

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.

◆ width

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: