SoapySDR
0.7.1-g5838bc91
Vendor and platform neutral SDR interface library
|
#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, ConverterFunction > | TargetFormatConverterPriority |
typedef std::map< std::string, TargetFormatConverterPriority > | TargetFormatConverters |
typedef std::map< std::string, TargetFormatConverters > | FormatConverters |
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< FunctionPriority > | listPriorities (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) |
ConverterRegistry class. The ConverterRegistry maintains a list of ConverterFunctions that can be queried and retrieved by markup strings for converting buffers between formats.
While Soapy standard format markup strings are declared in the formats include file, custom formats can be created and ConverterFunctions registered to be used as needed. Additionally, different functions can be registered for the same source/target pair with FunctionPriority serving as a selector to allow specialization.
typedef void(* SoapySDR::ConverterRegistry::ConverterFunction) (const void *, void *, const size_t, const double) |
A typedef for declaring a ConverterFunction to be maintained in the ConverterRegistry. A converter function copies and optionally converts an input buffer of one format into an output buffer of another format. The parameters are (input pointer, output pointer, number of elements, optional scalar)
typedef std::map<std::string, TargetFormatConverters> SoapySDR::ConverterRegistry::FormatConverters |
FormatConverters: a map of possible conversion functions for a given Source/Target Format. Maintained by the registry.
typedef std::map<FunctionPriority, ConverterFunction> SoapySDR::ConverterRegistry::TargetFormatConverterPriority |
TargetFormatConverterPriority: a map of possible conversion functions for a given Priority. Maintained by the registry.
typedef std::map<std::string, TargetFormatConverterPriority> SoapySDR::ConverterRegistry::TargetFormatConverters |
TargetFormatConverters: a map of possible conversion functions for a given Target/Priority Format. Maintained by the registry.
SoapySDR::ConverterRegistry::ConverterRegistry | ( | const std::string & | sourceFormat, |
const std::string & | targetFormat, | ||
const FunctionPriority & | priority, | ||
ConverterFunction | converter | ||
) |
Class constructor. Registers a ConverterFunction with a given source format, target format, and priority.
refuses to register converter and logs error if a source/target/priority entry already exists
sourceFormat | the source format markup string |
targetFormat | the target format markup string |
priority | the FunctionPriority of the converter to register |
converter | function to register |
|
static |
Get a converter between a source and target format with the highest available priority.
invalid_argument | when the conversion does not exist and logs error |
sourceFormat | the source format markup string |
targetFormat | the target format markup string |
|
static |
Get a converter between a source and target format with a given priority.
|
static |
Get a list of known source formats in the registry.
|
static |
Get a list of available converter priorities for a given source and target format.
sourceFormat | the source format markup string |
targetFormat | the target format markup string |
|
static |
Get a list of existing source formats from which we can convert to the specified target. There is a target format converter function registered for each source format returned in the result vector.
targetFormat | the target format markup string |
|
static |
Get a list of existing target formats to which we can convert the specified source from. There is a source format converter function registered for each target format returned in the result vector.
sourceFormat | the source format markup string |