SoapySDR: SoapySDR::ConverterRegistry Class Reference

| SoapySDR 0.8.1-ARCH Vendor and platform neutral SDR interface library

Loading...
Searching...
No Matches
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, 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)

## Detailed Description

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.

## Member Typedef Documentation

## ◆ ConverterFunction

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)

## ◆ FormatConverters

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.

## ◆ TargetFormatConverterPriority

typedef std::map<FunctionPriority, ConverterFunction> SoapySDR::ConverterRegistry::TargetFormatConverterPriority

TargetFormatConverterPriority: a map of possible conversion functions for a given Priority. Maintained by the registry.

## ◆ TargetFormatConverters

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.

## Member Enumeration Documentation

## ◆ FunctionPriority

enum SoapySDR::ConverterRegistry::FunctionPriority

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

Enumerator
GENERIC | Usual C for-loops, shifts, multiplies, etc. Min priority.
VECTORIZED | Vectorized operations such as SIMD.
CUSTOM | Custom user re-implementation. Max priority.

## Constructor & Destructor Documentation

## ◆ ConverterRegistry()

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

Parameters

  sourceFormat | the source format markup string
  targetFormat | the target format markup string
  priority | the FunctionPriority of the converter to register
  converter | function 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 with the highest available priority.

Exceptions

  invalid_argument | when the conversion does not exist and logs error

Parameters

  sourceFormat | the source format markup string
  targetFormat | the 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

Get a converter between a source and target format with a given priority.

## ◆ 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

  sourceFormat | the source format markup string
  targetFormat | the 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 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.

Parameters

  targetFormat | the 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 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.

Parameters

  sourceFormat | the 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:

- ConverterRegistry.hpp