UHD 003.005.002-0-unknown

- Main Page
- Namespaces
- Classes
- Files

- Namespace List
- Namespace Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
Namespaces | Classes | Typedefs | Functions
uhd Namespace Reference

## Namespaces
| _log
| convert
| csv
| msg
| transport
| usrp

## Classes
struct | otw_type_t
class | device
struct | exception
struct | assertion_error
struct | lookup_error
struct | index_error
struct | key_error
struct | type_error
struct | value_error
struct | runtime_error
struct | not_implemented_error
struct | environment_error
struct | io_error
struct | os_error
struct | system_error
class | property
struct | fs_path
class | property_tree
struct | stream_args_t
class | rx_streamer
class | tx_streamer
struct | clock_config_t
class | device_addr_t
class | dict
class | io_type_t
class | mac_addr_t
struct | rx_metadata_t
struct | tx_metadata_t
struct | async_metadata_t
class | range_t
struct | meta_range_t
class | ref_vector
struct | sensor_value_t
class | i2c_iface
struct | spi_config_t
class | spi_iface
class | uart_iface
struct | stream_cmd_t
class | time_spec_t
struct | tune_request_t
struct | tune_result_t
class | gps_ctrl
class | atomic_uint32_t
| A 32-bit integer that can be atomically accessed. More...
class | reusable_barrier
class | simple_claimer
struct | gain_fcns_t
class | gain_group
class | task

## Typedefs
typedef std::vector < device_addr_t > | device_addrs_t
| A typedef for a vector of device addresses. More...
typedef meta_range_t | gain_range_t
typedef meta_range_t | freq_range_t
typedef std::vector < boost::uint8_t > | byte_vector_t

## Functions
UHD_API fs_path | operator/ (const fs_path &, const fs_path &)
UHD_API device_addrs_t | separate_device_addr (const device_addr_t &dev_addr)
| Separate an indexed device address into a vector of device addresses. More...
UHD_API device_addr_t | combine_device_addrs (const device_addrs_t &dev_addrs)
| Combine a vector of device addresses into an indexed device address. More...
UHD_API bool | operator== (const time_spec_t &, const time_spec_t &)
| Implement equality_comparable interface. More...
UHD_API bool | operator< (const time_spec_t &, const time_spec_t &)
| Implement less_than_comparable interface. More...
template<typename Range >
Range | sorted (const Range &range)
template<typename Range >
Range | reversed (const Range &range)
template<typename Range , typename T >
bool | has (const Range &range, const T &value)
template<typename T >
T | clip (const T &val, const T &bound1, const T &bound2)
template<typename T , typename Range >
void | assert_has (const Range &range, const T &value, const std::string &what="unknown")
UHD_INLINE bool | spin_wait_with_timeout (atomic_uint32_t &cond, boost::uint32_t value, const double timeout)
boost::uint16_t | byteswap (boost::uint16_t)
| perform a byteswap on a 16 bit integer More...
boost::uint32_t | byteswap (boost::uint32_t)
| perform a byteswap on a 32 bit integer More...
boost::uint64_t | byteswap (boost::uint64_t)
| perform a byteswap on a 64 bit integer More...
template<typename T >
T | ntohx (T)
| network to host: short, long, or long-long More...
template<typename T >
T | htonx (T)
| host to network: short, long, or long-long More...
template<typename T >
T | wtohx (T)
| worknet to host: short, long, or long-long More...
template<typename T >
T | htowx (T)
| host to worknet: short, long, or long-long More...
UHD_API std::string | find_image_path (const std::string &image_name)
UHD_API std::string | find_images_downloader (void)
UHD_API std::string | print_images_error (void)
UHD_API std::string | get_tmp_path (void)
| Get a string representing the system's temporary directory. More...
UHD_API std::string | get_app_path (void)
| Get a string representing the system's appdata directory. More...
UHD_API std::string | get_pkg_data_path (void)
| Get a string representing the system's pkg data directory. More...
UHD_API void | set_thread_priority (float priority=default_thread_priority, bool realtime=true)
UHD_API bool | set_thread_priority_safe (float priority=default_thread_priority, bool realtime=true)
UHD_API std::string | get_version_string (void)
| Get the version string (dotted version number + build info) More...
UHD_API std::string | get_abi_string (void)
| Get the ABI compatibility string for this build of the library. More...

## Detailed Description

Define common exceptions used throughout the code:

- The python built-in exceptions were used as inspiration.
- Exceptions inherit from std::exception to provide what().
- Exceptions inherit from uhd::exception to provide code().

The code() provides an error code which allows the application the option of printing a cryptic error message from the 1990s.

The dynamic_clone() and dynamic_throw() methods allow us to: catch an exception by dynamic type (i.e. derived class), save it, and later rethrow it, knowing only the static type (i.e. base class), and then finally to catch it again using the derived type.

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2106.html

Useful templated functions and classes that I like to pretend are part of stl. Many of the range wrapper functions come with recent versions of boost (1.43).

## Typedef Documentation

typedef std::vector<boost::uint8_t> uhd::byte_vector_t

Byte vector typedef for passing data in and out of I2C interfaces.

typedef std::vector<device_addr_t> uhd::device_addrs_t

A typedef for a vector of device addresses.

typedef meta_range_t uhd::freq_range_t

typedef meta_range_t uhd::gain_range_t

## Function Documentation

template<typename T , typename Range >

void uhd::assert_has | ( | const Range & | range,
|  | const T & | value,
|  | const std::string & | what = `"unknown"`
| ) |  |

Check that an element is found in a container. If not, throw a meaningful assertion error. The "what" in the error will show what is being set and a list of known good values.

Parameters

  range | a list of possible settings
  value | an element that may be in the list
  what | a description of what the value is

Exceptions

  assertion_error | when elem not in list

boost::uint16_t uhd::byteswap | ( | boost::uint16_t |  | ) |

perform a byteswap on a 16 bit integer

boost::uint32_t uhd::byteswap | ( | boost::uint32_t |  | ) |

perform a byteswap on a 32 bit integer

boost::uint64_t uhd::byteswap | ( | boost::uint64_t |  | ) |

perform a byteswap on a 64 bit integer

template<typename T >

T uhd::clip | ( | const T & | val,
|  | const T & | bound1,
|  | const T & | bound2
| ) |  |
| inline

A templated clip implementation.

Parameters

  val | the value to clip between an upper and lower limit
  bound1 | the upper or lower bound
  bound2 | the upper or lower bound

Returns
  the value clipped at the bounds

UHD_API device_addr_t uhd::combine_device_addrs | ( | const device_addrs_t & | dev_addrs | ) |

Combine a vector of device addresses into an indexed device address.

UHD_API std::string uhd::find_image_path | ( | const std::string & | image_name | ) |

Search for an image in the system image paths: Search compiled-in paths and environment variable paths for a specific image file with the provided file name.

Parameters

  image_name | the name of the file

Returns
  the full system path to the file

Exceptions

  exception | if the image was not found

UHD_API std::string uhd::find_images_downloader | ( | void |  | ) |

Search for the location of the UHD Images Downloader script.

Returns
  the full system path to uhd_images_downloader.py

UHD_API std::string uhd::get_abi_string | ( | void |  | ) |

Get the ABI compatibility string for this build of the library.

UHD_API std::string uhd::get_app_path | ( | void |  | ) |

Get a string representing the system's appdata directory.

UHD_API std::string uhd::get_pkg_data_path | ( | void |  | ) |

Get a string representing the system's pkg data directory.

UHD_API std::string uhd::get_tmp_path | ( | void |  | ) |

Get a string representing the system's temporary directory.

UHD_API std::string uhd::get_version_string | ( | void |  | ) |

Get the version string (dotted version number + build info)

template<typename Range , typename T >

bool uhd::has | ( | const Range & | range,
|  | const T & | value
| ) |  |
| inline

Is the value found within the elements in this range?

Uses std::find to search the iterable for an element.

Parameters

  range | the elements to search through
  value | the match to look for in the range

Returns
  true when the value is found in the range

template<typename T >

T uhd::htonx | ( | T |  | ) |

host to network: short, long, or long-long

template<typename T >

T uhd::htowx | ( | T |  | ) |

host to worknet: short, long, or long-long

template<typename T >

T uhd::ntohx | ( | T |  | ) |

network to host: short, long, or long-long

UHD_API fs_path uhd::operator/ | ( | const fs_path & | ,
|  | const fs_path & |
| ) |  |

UHD_API bool uhd::operator< | ( | const time_spec_t & | ,
|  | const time_spec_t & |
| ) |  |

Implement less_than_comparable interface.

UHD_API bool uhd::operator== | ( | const time_spec_t & | ,
|  | const time_spec_t & |
| ) |  |

Implement equality_comparable interface.

UHD_API std::string uhd::print_images_error | ( | void |  | ) |

Return the error string for recommending using the UHD Images Downloader. String depends on OS.

Returns
  the message suggesting the use of uhd_images_downloader.py

template<typename Range >

Range uhd::reversed | ( | const Range & | range | ) |
| inline

A wrapper around std::reverse that takes a range instead of an iterator.

The elements are reversed into descending order using the less-than operator. This wrapper reverses the elements non-destructively into a new range. Based on the builtin python function reversed(...)

Parameters

  range | the range of elements to be reversed

Returns
  a new range with the elements reversed

UHD_API device_addrs_t uhd::separate_device_addr | ( | const device_addr_t & | dev_addr | ) |

Separate an indexed device address into a vector of device addresses.

UHD_API void uhd::set_thread_priority | ( | float | priority = `default_thread_priority`,
|  | bool | realtime = `true`
| ) |  |

Set the scheduling priority on the current thread.

A new thread or calling process should make this call with the defailts this to enable realtime scheduling.

A priority of zero corresponds to normal priority. Positive priority values are higher than normal. Negative priority values are lower than normal.

Parameters

  priority | a value between -1 and 1
  realtime | true to use realtime mode

Exceptions

  exception | on set priority failure

UHD_API bool uhd::set_thread_priority_safe | ( | float | priority = `default_thread_priority`,
|  | bool | realtime = `true`
| ) |  |

Set the scheduling priority on the current thread. Same as set_thread_priority but does not throw on failure.

Returns
  true on success, false on failure

template<typename Range >

Range uhd::sorted | ( | const Range & | range | ) |
| inline

A wrapper around std::sort that takes a range instead of an iterator.

The elements are sorted into ascending order using the less-than operator. This wrapper sorts the elements non-destructively into a new range. Based on the builtin python function sorted(...)

Parameters

  range | the range of elements to be sorted

Returns
  a new range with the elements sorted

UHD_INLINE bool uhd::spin_wait_with_timeout | ( | atomic_uint32_t & | cond,
|  | boost::uint32_t | value,
|  | const double | timeout
| ) |  |

Spin-wait on a condition with a timeout.

Parameters

  cond | an atomic variable to compare
  value | compare to atomic for true/false
  timeout | the timeout in seconds

Returns
  true for cond == value, false for timeout

template<typename T >

T uhd::wtohx | ( | T |  | ) |

worknet to host: short, long, or long-long