SoapySDR  0.7.0-unknown
Vendor and platform neutral SDR interface library
Public Types | Public Member Functions | Static Public Member Functions | List of all members
SoapySDR::ConverterRegistry Class Reference

#include <ConverterRegistry.hpp>

Public Types

enum  FunctionPriority { GENERIC = 0, VECTORIZED = 3, CUSTOM = 5 }
 
typedef void(* ConverterFunction) (const void *, void *, const size_t, const double)
 
typedef std::map< FunctionPriority, ConverterFunctionTargetFormatConverterPriority
 
typedef std::map< std::string, TargetFormatConverterPriorityTargetFormatConverters
 
typedef std::map< std::string, TargetFormatConvertersFormatConverters
 

Public Member Functions

 ConverterRegistry (const std::string &sourceFormat, const std::string &targetFormat, const FunctionPriority &priority, ConverterFunction converter)
 

Static Public Member Functions

static std::vector< std::string > listTargetFormats (const std::string &sourceFormat)
 
static std::vector< std::string > listSourceFormats (const std::string &targetFormat)
 
static std::vector< FunctionPrioritylistPriorities (const std::string &sourceFormat, const std::string &targetFormat)
 
static ConverterFunction getFunction (const std::string &sourceFormat, const std::string &targetFormat)
 
static ConverterFunction getFunction (const std::string &sourceFormat, const std::string &targetFormat, const FunctionPriority &priority)
 
static std::vector< std::string > listAvailableSourceFormats (void)
 

Member Typedef Documentation

◆ ConverterFunction

typedef void(* SoapySDR::ConverterRegistry::ConverterFunction) (const void *, void *, const size_t, const double)

A typedef for a conversion function pointer. A conversion function converts an input buffer into an output buffer. The parameters are (input pointer, output pointer, number of elements, optional scalar)

◆ FormatConverters

FormatConverters: a map of possible conversion functions for a given Source/Target Format.

◆ TargetFormatConverterPriority

TargetFormatConverterPriority: a map of possible conversion functions for a given Priority.

◆ TargetFormatConverters

TargetFormatConverters: a map of possible conversion functions for a given Target/Priority Format.

Member Enumeration Documentation

◆ FunctionPriority

FormatConverterPriority: allow selection of a converter function with a given source and target format

Enumerator
GENERIC 
VECTORIZED 
CUSTOM 

Constructor & Destructor Documentation

◆ ConverterRegistry()

SoapySDR::ConverterRegistry::ConverterRegistry ( const std::string &  sourceFormat,
const std::string &  targetFormat,
const FunctionPriority priority,
ConverterFunction  converter 
)

Class constructor for managing the Converter Registry. refuses to register converter and logs error if a source/target/priority entry already exists

Parameters
sourceFormatthe source format markup string
targetFormatthe target format markup string
prioritythe FunctionPriority of the converter to register
converterfunction to register

Member Function Documentation

◆ getFunction() [1/2]

static ConverterFunction SoapySDR::ConverterRegistry::getFunction ( const std::string &  sourceFormat,
const std::string &  targetFormat 
)
static

Get a converter between a source and target format.

Exceptions
invalid_argumentwhen the conversion does not exist and logs error
Parameters
sourceFormatthe source format markup string
targetFormatthe target format markup string
Returns
a conversion function pointer

◆ getFunction() [2/2]

static ConverterFunction SoapySDR::ConverterRegistry::getFunction ( const std::string &  sourceFormat,
const std::string &  targetFormat,
const FunctionPriority priority 
)
static

◆ listAvailableSourceFormats()

static std::vector<std::string> SoapySDR::ConverterRegistry::listAvailableSourceFormats ( void  )
static

Get a list of known source formats in the registry.

◆ listPriorities()

static std::vector<FunctionPriority> SoapySDR::ConverterRegistry::listPriorities ( const std::string &  sourceFormat,
const std::string &  targetFormat 
)
static

Get a list of available converter priorities for a given source and target format.

Parameters
sourceFormatthe source format markup string
targetFormatthe target format markup string
Returns
a vector of priorities or an empty vector if none found

◆ listSourceFormats()

static std::vector<std::string> SoapySDR::ConverterRegistry::listSourceFormats ( const std::string &  targetFormat)
static

Get a list of formats to which we can convert the target format from. There is a registered conversion function from every source format returned in the result vector to the specified target format.

Parameters
targetFormatthe target format markup string
Returns
a vector of source formats or an empty vector if none found

◆ listTargetFormats()

static std::vector<std::string> SoapySDR::ConverterRegistry::listTargetFormats ( const std::string &  sourceFormat)
static

Get a list of formats to which we can convert the source format into. There is a registered conversion function from the specified source format to every target format returned in the result vector.

Parameters
sourceFormatthe source format markup string
Returns
a vector of target formats or an empty vector if none found

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