Pothos  0.4.2-g932b6da0
The Pothos dataflow programming software suite
Classes | Functions
Pothos::Util Namespace Reference

Classes

class  Compiler
 
class  CompilerArgs
 
class  EvalEnvironment
 
class  FileLock
 
class  OrderedQueue
 
class  RefHolder
 
class  RingDeque
 
class  SpinLock
 
class  UID
 

Functions

template<typename T0 , typename T1 >
int compareTo (const T0 &v0, const T1 &v1)
 
POTHOS_API std::string typeInfoToString (const std::type_info &type)
 
POTHOS_API bool isIPv6Supported (void)
 
POTHOS_API std::string getWildcardAddr (const std::string &service="")
 
POTHOS_API std::string getLoopbackAddr (const std::string &service="")
 
template<typename T , typename U >
std::enable_if< std::is_floating_point< U >::value, T >::type fromQ (const U &in, const int=0)
 
template<typename T , typename U >
std::enable_if< std::is_integral< U >::value, T >::type fromQ (const U &in, const int n=sizeof(U)*4)
 
template<typename T , typename U >
std::enable_if< std::is_floating_point< U >::value, T >::type fromQ (const std::complex< U > &in, const int=0)
 
template<typename T , typename U >
std::enable_if< std::is_integral< U >::value, T >::type fromQ (const std::complex< U > &in, const int n=sizeof(U)*4)
 
template<typename T , typename U >
std::enable_if< std::is_floating_point< T >::value, T >::type floatToQ (const U &in, const int=0)
 
template<typename T , typename U >
std::enable_if< std::is_integral< T >::value, T >::type floatToQ (const U &in, const int n=sizeof(T)*4)
 
template<typename T , typename U >
std::enable_if< std::is_floating_point< typename T::value_type >::value, T >::type floatToQ (const std::complex< U > &in, const int=0)
 
template<typename T , typename U >
std::enable_if< std::is_integral< typename T::value_type >::value, T >::type floatToQ (const std::complex< U > &in, const int n=sizeof(typename T::value_type)*4)
 

Function Documentation

template<typename T0 , typename T1 >
int Pothos::Util::compareTo ( const T0 &  v0,
const T1 &  v1 
)

Compare two objects and return a integer result. The objects being compared require operator==() and operator<().

Parameters
v0value on the left hand side of the comparison
v1value on the right hand side of the comparison
Returns
0 for equal, -1 if v0 < v1, +1 if v0 > v1
template<typename T , typename U >
std::enable_if<std::is_floating_point<T>::value, T>::type Pothos::Util::floatToQ ( const U &  in,
const int  = 0 
)

Convert a floating point number into Q format.

  • Floating point outputs are passed-through without change.
  • Fixed point outputs are shifted up by the number of fractional bits.
  • The fractional bits default to half of the fixed point integer size.
Template Parameters
Tthe output data type
Uthe input data type
Parameters
inthe input number
nthe number of fractional bits
Returns
the output number in Q format
template<typename T , typename U >
std::enable_if<std::is_integral<T>::value, T>::type Pothos::Util::floatToQ ( const U &  in,
const int  n = sizeof(T)*4 
)

Convert a floating point number into Q format.

  • Floating point outputs are passed-through without change.
  • Fixed point outputs are shifted up by the number of fractional bits.
  • The fractional bits default to half of the fixed point integer size.
Template Parameters
Tthe output data type
Uthe input data type
Parameters
inthe input number
nthe number of fractional bits
Returns
the output number in Q format
template<typename T , typename U >
std::enable_if<std::is_floating_point<typename T::value_type>::value, T>::type Pothos::Util::floatToQ ( const std::complex< U > &  in,
const int  = 0 
)

Convert a floating point number into Q format.

  • Floating point outputs are passed-through without change.
  • Fixed point outputs are shifted up by the number of fractional bits.
  • The fractional bits default to half of the fixed point integer size.
Template Parameters
Tthe output data type
Uthe input data type
Parameters
inthe input number
nthe number of fractional bits
Returns
the output number in Q format
template<typename T , typename U >
std::enable_if<std::is_integral<typename T::value_type>::value, T>::type Pothos::Util::floatToQ ( const std::complex< U > &  in,
const int  n = sizeof(typename T::value_type)*4 
)

Convert a floating point number into Q format.

  • Floating point outputs are passed-through without change.
  • Fixed point outputs are shifted up by the number of fractional bits.
  • The fractional bits default to half of the fixed point integer size.
Template Parameters
Tthe output data type
Uthe input data type
Parameters
inthe input number
nthe number of fractional bits
Returns
the output number in Q format
template<typename T , typename U >
std::enable_if<std::is_floating_point<U>::value, T>::type Pothos::Util::fromQ ( const U &  in,
const int  = 0 
)

Convert from a Q format number.

  • Floating point inputs are passed-through without change.
  • Fixed point inputs are down-shifted by the number of fractional bits.
  • The fractional bits default to half of the fixed point integer size.
Template Parameters
Tthe output data type
Uthe input data type
Parameters
inthe input number in Q format
nthe number of fractional bits
Returns
the output number
template<typename T , typename U >
std::enable_if<std::is_integral<U>::value, T>::type Pothos::Util::fromQ ( const U &  in,
const int  n = sizeof(U)*4 
)

Convert from a Q format number.

  • Floating point inputs are passed-through without change.
  • Fixed point inputs are down-shifted by the number of fractional bits.
  • The fractional bits default to half of the fixed point integer size.
Template Parameters
Tthe output data type
Uthe input data type
Parameters
inthe input number in Q format
nthe number of fractional bits
Returns
the output number
template<typename T , typename U >
std::enable_if<std::is_floating_point<U>::value, T>::type Pothos::Util::fromQ ( const std::complex< U > &  in,
const int  = 0 
)

Convert from a Q format number.

  • Floating point inputs are passed-through without change.
  • Fixed point inputs are down-shifted by the number of fractional bits.
  • The fractional bits default to half of the fixed point integer size.
Template Parameters
Tthe output data type
Uthe input data type
Parameters
inthe input number in Q format
nthe number of fractional bits
Returns
the output number
template<typename T , typename U >
std::enable_if<std::is_integral<U>::value, T>::type Pothos::Util::fromQ ( const std::complex< U > &  in,
const int  n = sizeof(U)*4 
)

Convert from a Q format number.

  • Floating point inputs are passed-through without change.
  • Fixed point inputs are down-shifted by the number of fractional bits.
  • The fractional bits default to half of the fixed point integer size.
Template Parameters
Tthe output data type
Uthe input data type
Parameters
inthe input number in Q format
nthe number of fractional bits
Returns
the output number
POTHOS_API std::string Pothos::Util::getLoopbackAddr ( const std::string &  service = "")

Get a functioning loopback address "::1" or "127.0.0.1".

Parameters
servicean optional service or port number
Returns
the loopback address (IPv6 is available)
POTHOS_API std::string Pothos::Util::getWildcardAddr ( const std::string &  service = "")

Get a functioning wildcard address "::" or "0.0.0.0".

Parameters
servicean optional service or port number
Returns
the wildcard address (IPv6 is available)
POTHOS_API bool Pothos::Util::isIPv6Supported ( void  )

Does this system support IPv6?

Returns
true if supported
POTHOS_API std::string Pothos::Util::typeInfoToString ( const std::type_info &  type)

Helper method to get the string representation of a type info. The implementation may look up in a table or demangles type.name().