GNSS-SDR  0.0.13
An Open Source GNSS Software Defined Receiver
Typedefs | Functions
item_type_helpers.h File Reference

Utility functions for converting between item types. More...

#include <cstdint>
#include <functional>
#include <string>

Go to the source code of this file.

Typedefs

using item_type_converter_t = std::function< void(void *, const void *, uint32_t)>
 

Functions

bool item_type_valid (const std::string &item_type)
 Check if a string is a valid item type. More...
 
size_t item_type_size (const std::string &item_type)
 Return the size of the given item type, or zero if unknown. More...
 
bool item_type_is_complex (const std::string &item_type)
 Determine if an item_type is complex. More...
 
item_type_converter_t make_vector_converter (const std::string &input_type, const std::string &output_type)
 Create a function to convert an array of input_type to an array of output_type. More...
 

Detailed Description

Utility functions for converting between item types.

Authors
  • Cillian O'Driscoll, 2019. cillian.odriscoll(at)gmail.com

Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)

GNSS-SDR is a software defined Global Navigation Satellite Systems receiver

This file is part of GNSS-SDR.

SPDX-License-Identifier: GPL-3.0-or-later


Definition in file item_type_helpers.h.

Function Documentation

◆ item_type_is_complex()

bool item_type_is_complex ( const std::string &  item_type)

Determine if an item_type is complex.

◆ item_type_size()

size_t item_type_size ( const std::string &  item_type)

Return the size of the given item type, or zero if unknown.

◆ item_type_valid()

bool item_type_valid ( const std::string &  item_type)

Check if a string is a valid item type.

Valid item types include: "byte", "short", "float", "ibyte", "ishort", "cbyte", "cshort", "gr_complex"

◆ make_vector_converter()

item_type_converter_t make_vector_converter ( const std::string &  input_type,
const std::string &  output_type 
)

Create a function to convert an array of input_type to an array of output_type.

Provides a generic interface to generate conversion functions for mapping arrays of items.

Parameters
input_type- String representation of the input item type
output_type- String representation of the output item type

The item types accepted are:

  1. "byte" for 8 bit integers
  2. "cbyte" for complex (interleaved) 8 bit integers
  3. "ibyte" for complex (interleaved) 8 bit integers
  1. "short" for 16 bit integers
  2. "cshort" for complex (interleaved) 16 bit integers
  3. "ishort" for complex (interleaved) 16 bit integers
  4. "float" for 32 bit floating point values
  5. "gr_complex" for complex (interleaved) 32 bit floating point values
Returns
A function object with the following prototype: void convert_fun( void *dest, void *src, int num_items );