Pothos  0.3.3-g32d3017c
The Pothos dataflow programming software suite
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros
Public Member Functions | List of all members
Pothos::DType Class Reference

#include <DType.hpp>

Public Member Functions

 DType (void)
 Create an unknown DType of size 1. More...
 
 DType (const char *markup)
 
 DType (const std::string &markup)
 
 DType (const std::string &alias, const size_t dimension)
 
 DType (const std::type_info &type, const size_t dimension=1)
 
const std::string & name (void) const
 
size_t elemType (void) const
 Get the element type descriptor. More...
 
size_t elemSize (void) const
 Get the size of a single element in bytes. More...
 
size_t dimension (void) const
 Get the dimensionality of this type. More...
 
size_t size (void) const
 Get the size of this DType in bytes. More...
 
std::string toString (void) const
 Create a printable string representation. More...
 
std::string toMarkup (void) const
 
pothos_explicit operator bool (void) const
 
bool isCustom (void) const
 
bool isFloat (void) const
 
bool isInteger (void) const
 
bool isSigned (void) const
 
bool isComplex (void) const
 
template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 Serialization support. More...
 

Detailed Description

DType provides meta-information about a data type. A DType consists of a primitive element type and dimensionality. The dimensionality is a simple number that allows a DType to represent an integer number of primitive element per object.

DType will recognize the alias names for the most common types like: primitive integers, fixed width types, floating point types, complex...

Recognized name strings:

Special name strings:

Constructor & Destructor Documentation

Pothos::DType::DType ( void  )
inline

Create an unknown DType of size 1.

Pothos::DType::DType ( const char *  markup)

Create a DType from only a markup string (char * overload).

Exceptions
DTypeUnknownErrorwhen the name is not known
Parameters
markupthe name identfier of a known DType
Pothos::DType::DType ( const std::string &  markup)

Create a DType from only a markup string. The markup name is a type alias (like float32), with optional comma separated dimensionality.

  • Example markup: "float32"
  • Example markup: "uint8, 2"
Exceptions
DTypeUnknownErrorwhen the name is not known
Parameters
markupthe name identfier of a known DType
Pothos::DType::DType ( const std::string &  alias,
const size_t  dimension 
)

Create a DType from a type alias and dimensionality.

Exceptions
DTypeUnknownErrorwhen the name is not known
Parameters
aliasa string identfier for a known data type
dimensionthe number of elements per type
Pothos::DType::DType ( const std::type_info &  type,
const size_t  dimension = 1 
)

Create a DType from a type_info identifier and optional dimensionality. The size and type enum are inferred from the type info.

Exceptions
DTypeUnknownErrorwhen the type is not known
Parameters
typea recognized type info object
dimensionthe number of elements per type

Member Function Documentation

size_t Pothos::DType::dimension ( void  ) const
inline

Get the dimensionality of this type.

size_t Pothos::DType::elemSize ( void  ) const
inline

Get the size of a single element in bytes.

size_t Pothos::DType::elemType ( void  ) const
inline

Get the element type descriptor.

bool Pothos::DType::isComplex ( void  ) const

Does this dtype represent a complex data type?

Returns
true when the type is std::complex<primitive type>
bool Pothos::DType::isCustom ( void  ) const

Does this dtype represent a custom type?

Returns
true when the type was constructed with "custom"
bool Pothos::DType::isFloat ( void  ) const

Does this dtype represent a floating point data type?

Returns
true for floats, doubles, and complex floats, doubles
bool Pothos::DType::isInteger ( void  ) const

Does this dtype represent an integer data type?

Returns
true for fixed width integer types and complex integer types
bool Pothos::DType::isSigned ( void  ) const

Does this dtype represent a signed data type?

Returns
true for signed integer, complex signed integer types.
const std::string& Pothos::DType::name ( void  ) const

Get a name that describes an element. Example: int32, uint16, complex_float32, etc...

Pothos::DType::operator bool ( void  ) const
inline

Does this dtype specify a non-empty type?

Returns
false for default constructor/empty string
template<class Archive >
void Pothos::DType::serialize ( Archive &  ar,
const unsigned int  version 
)

Serialization support.

size_t Pothos::DType::size ( void  ) const
inline

Get the size of this DType in bytes.

std::string Pothos::DType::toMarkup ( void  ) const

Create a markup string which can be parsed by the constructor.

Returns
the markup string with data type and optional dimensionality
std::string Pothos::DType::toString ( void  ) const

Create a printable string representation.


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