RAVENNAKIT
Loading...
Searching...
No Matches
rav Namespace Reference

Namespaces

namespace  aes67
namespace  clock
namespace  file
namespace  common_paths
namespace  rank
namespace  dnssd
namespace  nmos
namespace  ntp
namespace  ptp
namespace  rtp
namespace  rtcp
namespace  rtsp
namespace  sdp

Classes

class  AudioBuffer
 A dynamically sizeable buffer to store non-interleaved audio, along with an array of pointers to the beginning of each channel. More...
class  AudioBufferView
 A non-owning view of a non-interleaved audio buffer. More...
class  AudioData
class  AudioFifoBuffer
struct  AudioFormat
class  WavAudioFormat
class  BufferView
 A class similar to std::string_view but for raw data buffers. More...
class  ByteBuffer
 A wrapper around std::vector with some facilities for writing different types to it in different byte orders. More...
struct  Fifo
class  FifoBuffer
 A classic FIFO buffer implementation with different strategies F. More...
class  StringBuffer
 Simple buffer around a string that allows for easy reading and writing of values. More...
class  VectorBuffer
 Simple buffer around a vector that allows for easy reading and writing of values. More...
class  Exception
struct  Fraction
 Little tiny struct to represent a fraction without loss. More...
struct  IntervalStats
 Keeps track of an ema with outliers filtered out and a max deviation. More...
class  Range
 Represents a range of values. More...
class  RunningAverage
 A running average. More...
class  SlidingStats
 Values can be added after which different calculations can be performed on the values. More...
class  HttpClientBase
class  HttpClient
 A high level wrapper around boost::beast for making HTTP requests. More...
class  HttpRouter
 A simple HTTP router that matches HTTP requests to handlers based on the method and path. More...
class  HttpServer
 A high-level wrapper around boost::beast for creating an HTTP server. More...
class  MacAddress
 Represents a MAC address. More...
class  NetworkInterface
 Represents a network interface in the system. More...
class  NetworkInterfaceConfig
class  NetworkInterfaceList
 A list of network interfaces with some convenience functions to operate on them. More...
class  ExtendedUdpSocket
 A customized UDP socket class which extends usual UDP socket functionality by adding the ability to receive the destination address of a received packet. More...
class  AsioTimer
 A timer that uses boost::asio::steady_timer to provide a simple way of creating a timer without thinking about the lifetimes. More...
class  Random
class  ByteStream
 Simple stream implementation that writes to and reads from a vector. More...
class  FileInputStream
 An implementation of input_stream for reading from a file. More...
class  FileOutputStream
 An implementation of output_stream for writing to a file. More...
class  InputStream
 Baseclass for classes that want to provide stream-like access to data. More...
class  InputStreamView
 A non-owning view of some data that can be read from. More...
class  OutputStream
 An abstract class representing an output stream, providing all kinds of write operations. More...
class  StringParser
 A handy utility class for parsing strings. More...
class  AtomicRwLock
 A lock-free (and sometimes wait-free) reader writer lock. More...
class  RealtimeSharedObject
 This class provides a real-time safe way to share objects among a single reader. More...
class  int24_t
 A custom type to represent a 3-byte audio sample. More...
class  SafeInt
 A safe integer type that checks for overflow and underflow when performing arithmetic operations. More...
class  uint48_t
 Custom 48 bit unsigned integer type. More...
class  Defer
 A class that holds a rollback function, calling it upon destruction unless a commit is made. More...
class  Id
 A class which represents a unique identifier. More...
class  ObjectCounter
 Holds the number of instances created and destroyed. More...
class  CountedObject
 Little helper class which keeps track of how many instances of this class have been created and how many are still alive. More...
class  PathMatcher
 A simple path matcher that matches paths against patterns. More...
class  SafeFunction
 A simple callback function wrapper that can be used to store and call a function with a specific signature. More...
class  SafeFunction< R(Args...)>
class  SubscriberList
 Super basic list of subscribers. More...
class  SubscriberList< T, void >
 Specialize the void case. More...
class  Throttle
 A class that throttles a value to a given interval. More...
class  Throttle< void >
 Specialization for void, which doesn't store a value. More...
struct  Uri
 URI parser and encoder. More...
class  WrappingUint
 Represents sequence numbers with rollover (wraparound) semantics. More...
class  RavennaBrowser
 Convenience class which contains a dnssd browser for nodes and sessions. More...
class  RavennaNode
 This class contains all the components to act like a RAVENNA node as specified in the RAVENNA protocol. More...
class  RavennaReceiver
class  RavennaRtspClient
 Maintains connections to one or more RAVENNA RTSP servers, upon request. More...
class  RavennaSender

Typedefs

using ip_address = boost::asio::ip::address
using ip_address_v4 = boost::asio::ip::address_v4
using ip_address_v6 = boost::asio::ip::address_v6
using udp_socket = boost::asio::ip::udp::socket
using udp_endpoint = boost::asio::ip::udp::endpoint
using tcp = boost::asio::ip::tcp
using SafeInt8 = SafeInt<int8_t>
using SafeInt16 = SafeInt<int16_t>
using SafeInt32 = SafeInt<int32_t>
using SafeInt64 = SafeInt<int64_t>
using SafeUint8 = SafeInt<uint8_t>
using SafeUint16 = SafeInt<uint16_t>
using SafeUint32 = SafeInt<uint32_t>
using SafeUint64 = SafeInt<uint64_t>
using WrappingUint8 = WrappingUint<uint8_t>
 8-bit wrapping unsigned integer.
using WrappingUint16 = WrappingUint<uint16_t>
 16-bit wrapping unsigned integer.
using WrappingUint32 = WrappingUint<uint32_t>
 32-bit wrapping unsigned integer.
using WrappingUint64 = WrappingUint<uint64_t>
 64-bit wrapping unsigned integer.

Enumerations

enum class  AudioEncoding : uint8_t {
  undefined , pcm_s8 , pcm_u8 , pcm_s16 ,
  pcm_s24 , pcm_s32 , pcm_f32 , pcm_f64
}
enum class  SafeIntError { overflow , underflow , div_by_zero }

Functions

uint8_t audio_encoding_bytes_per_sample (const AudioEncoding encoding)
uint8_t audio_encoding_ground_value (const AudioEncoding encoding)
const char * to_string (const AudioEncoding encoding)
std::optional< AudioEncoding > audio_encoding_from_string (const char *str)
void swap_bytes (uint8_t *data, const size_t size)
 Swaps given amount of bytes in the given data, in place.
void swap_bytes (uint8_t *data, const size_t size, const size_t stride)
 Swaps given amount of bytes in the given data, in place, with the given stride.
template<typename Type, std::enable_if_t< std::is_trivially_copyable_v< Type >, bool > = true>
Type swap_bytes (Type value)
template<>
float swap_bytes< float > (const float value)
 Specialization of swap_bytes for floats.
template<>
double swap_bytes< double > (const double value)
 Specialization of swap_bytes for doubles.
template<typename Type, std::enable_if_t< std::is_trivially_copyable_v< Type >, bool > = true>
Type swap_if_le (const Type value)
 Swaps the bytes of the given value if the system is little-endian.
template<typename Type, std::enable_if_t< std::is_trivially_copyable_v< Type >, bool > = true>
Type swap_if_be (const Type value)
 Swaps the bytes of the given value if the system is big-endian.
template<typename Type, std::enable_if_t< std::is_trivially_copyable_v< Type >, bool > = true>
Type read_ne (const uint8_t *data)
 Reads a value from the given data in native byte order (not to be confused with network-endian).
template<typename Type, std::enable_if_t< std::is_trivially_copyable_v< Type >, bool > = true>
Type read_be (const uint8_t *data)
 Reads a big-endian value from the given data.
template<typename Type, std::enable_if_t< std::is_trivially_copyable_v< Type >, bool > = true>
Type read_le (const uint8_t *data)
 Reads a little-endian value from the given data.
template<typename Type, std::enable_if_t< std::is_trivially_copyable_v< Type >, bool > = true>
void write_ne (uint8_t *dst, const Type value)
 Writes a value to the given destination in native byte order (not to be confused with network-endian).
template<typename Type, std::enable_if_t< std::is_trivially_copyable_v< Type >, bool > = true>
void write_be (uint8_t *dst, const Type value)
 Writes a big-endian value to the given destination.
template<typename Type, std::enable_if_t< std::is_trivially_copyable_v< Type >, bool > = true>
void write_le (uint8_t *dst, const Type value)
 Writes a little-endian value to the given destination.
bool is_little_endian_at_runtime () noexcept
 Checks if the system is little-endian at runtime.
void validate_byte_order ()
 Validates whether the compiled byte order matches the runtime byte order.
std::optional< std::string > get_env (const char *name)
 Gets the value of an environment variable.
template<typename T>
boost::system::result< T > parse_json (const std::string_view json_str)
void set_log_level (const char *level)
 Sets the log level for the application based on the given string.
void set_log_level_from_env (const char *env_var="RAV_LOG_LEVEL")
 Tries to find given environment variable and set the log level accordingly.
std::optional< NetworkInterfaceConfig > parse_network_interface_config_from_string (const std::string &input, const char delimiter=',')
size_t receive_from_socket (boost::asio::ip::udp::socket &socket, std::array< uint8_t, 1500 > &data_buf, boost::asio::ip::udp::endpoint &src_endpoint, boost::asio::ip::udp::endpoint &dst_endpoint, uint64_t &recv_time, boost::system::error_code &ec)
std::string_view string_up_to_first_occurrence_of (std::string_view string_to_search_in, const std::string_view string_to_search_for, const bool include_sub_string_in_result)
 Returns a string truncated up to the first occurrence of a needle.
std::string_view string_up_to_the_nth_occurrence_of (const size_t nth, std::string_view string_to_search_in, const std::string_view string_to_search_for, const bool include_sub_string_in_result)
 Returns a string truncated up to the nth occurrence of a needle.
std::string_view string_up_to_last_occurrence_of (const std::string_view string_to_search_in, const std::string_view string_to_search_for, const bool include_sub_string_in_result)
 Returns a string truncated up to the last occurrence of a needle.
std::string_view string_from_first_occurrence_of (std::string_view string_to_search_in, const std::string_view string_to_search_for, const bool include_sub_string_in_result)
 Returns a string truncated starting from to first last occurrence of a needle.
std::string_view string_from_nth_occurrence_of (const size_t nth, std::string_view string_to_search_in, const std::string_view string_to_search_for, const bool include_sub_string_in_result)
 Returns a string truncated from the nth occurrence of a needle.
std::string_view string_from_last_occurrence_of (const std::string_view string_to_search_in, const std::string_view string_to_search_for, const bool include_sub_string_in_result)
 Returns a string truncated starting from to last occurrence of a needle.
std::string_view string_remove_prefix (const std::string_view &string, const std::string_view prefix_to_remove, bool *found=nullptr)
 Returns a copy of string with given prefix removed, if prefix is found at the beginning of the string.
std::string_view string_remove_suffix (const std::string_view &string, const std::string_view suffix_to_remove, bool *found=nullptr)
 Returns a copy of string with given suffix removed, if suffix is found at the end of the string.
std::string_view string_trim (const std::string_view input)
 Trims given string by removing whitespace at the start and the end or the string.
template<typename Type>
std::enable_if_t< std::is_integral_v< Type >, std::optional< Type > > string_to_int (std::string_view string, const bool strict=false, const int base=10)
 String to number - a small convenience function around std::from_chars.
std::optional< float > string_to_float (const std::string &str)
 String to float - converts a string to a float, or returns an empty optional if the conversion failed.
std::optional< double > string_to_double (const std::string &str)
 String to double - converts a string to a double, or returns an empty optional if the conversion failed.
bool string_starts_with (const std::string_view text, const std::string_view starts_with)
 Tests whether given text starts with a certain string.
bool string_ends_with (const std::string_view text, const std::string_view ends_with)
 Tests whether given text ends with a certain string.
bool string_contains (const std::string_view string, char c)
 Returns whether given string contains a certain character.
bool string_contains (const std::string_view string, const std::string_view sub_string)
 Returns whether given string contains a certain substring.
std::vector< std::string > string_split (const std::string &string, const char *delimiter)
 Splits a string into a vector of strings based on a delimiter.
std::vector< std::string > string_split (const std::string &string, const char delimiter)
 Splits a string into a vector of strings based on a delimiter.
std::string string_replace (const std::string_view original, const std::string_view to_replace, const std::string_view replacement)
 Replaces all sequences of to_replace with replacement.
std::string_view string_unquoted (std::string_view input)
 If given string is quoted, it will remove the quotes.
bool string_compare_case_insensitive (const std::string_view lhs, const std::string_view rhs)
 Compares 2 strings case-insensitively.
std::string string_to_upper (const std::string &str, std::size_t count=std::numeric_limits< size_t >::max())
 Converts the first count characters of a string to upper case.
std::string string_to_lower (const std::string &str, std::size_t count=std::numeric_limits< size_t >::max())
 Converts the first count characters of a string to lower case.
template<typename T>
T & get_global_instance_of_type ()
 This function returns a reference to a read/write, default-constructed static object of type T.
template<typename T>
const T & get_global_const_instance_of_type ()
 This function returns a reference to a read-only, default-constructed static object of type T.
void do_system_checks ()
template<typename Type, size_t N>
constexpr size_t num_elements_in_array (Type(&)[N]) noexcept
 Returns the number of elements in a c-style array.
template<typename T>
bool is_within (T a, T b, T tolerance)
 Tests if two values are within a certain tolerance of each other.
template<typename T>
bool is_between (T a, T min, T max)
 Tests if a value is between two other values, inclusive.
std::ostream & operator<< (std::ostream &os, const PathMatcher::Error err)
BOOST_NORETURN BOOST_NOINLINE void throw_exception_from_error (PathMatcher::Error const &e, boost::source_location const &loc)
template<typename Container, typename Pred>
size_t stl_remove_if (Container &container, Pred pred)
 Convenience function to remove items from an stl container which match pred.
template<typename Map, typename Key>
auto stl_get_or_default (const Map &map, const Key &key) -> typename Map::mapped_type
 Convenience function to get an item from a map, or if the item doesn't exist return a default value.
template<typename T, std::size_t N, typename F, std::size_t... Is>
std::array< T, N > generate_array_impl (F &&f, std::index_sequence< Is... >)
template<typename T, std::size_t N, typename F>
std::array< T, N > generate_array (F &&f)
 Helper function to initialize std::array with non-copyable types.
void tracy_point ()
 Sometimes you want to know when something happened, but you don't want to instrument functions which get called into.
std::string to_string (const RavennaNode::Configuration &configuration)
tl::expected< rtp::AudioReceiver::ReaderParameters, std::string > create_rtp_receiver_parameters (const sdp::SessionDescription &sdp)
 Creates rtp receiver parameters from the given SDP.
void tag_invoke (const boost::json::value_from_tag &, boost::json::value &jv, const RavennaReceiver::Configuration &config)
RavennaReceiver::Configuration tag_invoke (const boost::json::value_to_tag< RavennaReceiver::Configuration > &, const boost::json::value &jv)
void tag_invoke (const boost::json::value_from_tag &, boost::json::value &jv, const RavennaSender::Destination &destination)
RavennaSender::Destination tag_invoke (const boost::json::value_to_tag< RavennaSender::Destination > &, const boost::json::value &jv)
void tag_invoke (const boost::json::value_from_tag &, boost::json::value &jv, const RavennaSender::Configuration &config)
RavennaSender::Configuration tag_invoke (const boost::json::value_to_tag< RavennaSender::Configuration > &, const boost::json::value &jv)

Variables

static constexpr bool little_endian = true
static constexpr bool big_endian = false

Typedef Documentation

◆ ip_address

using rav::ip_address = boost::asio::ip::address

Definition at line 31 of file asio_helpers.hpp.

◆ ip_address_v4

using rav::ip_address_v4 = boost::asio::ip::address_v4

Definition at line 32 of file asio_helpers.hpp.

◆ ip_address_v6

using rav::ip_address_v6 = boost::asio::ip::address_v6

Definition at line 33 of file asio_helpers.hpp.

◆ SafeInt16

using rav::SafeInt16 = SafeInt<int16_t>

Definition at line 294 of file safe_int.hpp.

◆ SafeInt32

using rav::SafeInt32 = SafeInt<int32_t>

Definition at line 295 of file safe_int.hpp.

◆ SafeInt64

using rav::SafeInt64 = SafeInt<int64_t>

Definition at line 296 of file safe_int.hpp.

◆ SafeInt8

using rav::SafeInt8 = SafeInt<int8_t>

Definition at line 293 of file safe_int.hpp.

◆ SafeUint16

using rav::SafeUint16 = SafeInt<uint16_t>

Definition at line 298 of file safe_int.hpp.

◆ SafeUint32

using rav::SafeUint32 = SafeInt<uint32_t>

Definition at line 299 of file safe_int.hpp.

◆ SafeUint64

using rav::SafeUint64 = SafeInt<uint64_t>

Definition at line 300 of file safe_int.hpp.

◆ SafeUint8

using rav::SafeUint8 = SafeInt<uint8_t>

Definition at line 297 of file safe_int.hpp.

◆ tcp

using rav::tcp = boost::asio::ip::tcp

Definition at line 38 of file http_client.hpp.

◆ udp_endpoint

using rav::udp_endpoint = boost::asio::ip::udp::endpoint

Definition at line 35 of file asio_helpers.hpp.

◆ udp_socket

using rav::udp_socket = boost::asio::ip::udp::socket

Definition at line 34 of file asio_helpers.hpp.

◆ WrappingUint16

using rav::WrappingUint16 = WrappingUint<uint16_t>

16-bit wrapping unsigned integer.

Definition at line 261 of file wrapping_uint.hpp.

◆ WrappingUint32

using rav::WrappingUint32 = WrappingUint<uint32_t>

32-bit wrapping unsigned integer.

Definition at line 264 of file wrapping_uint.hpp.

◆ WrappingUint64

using rav::WrappingUint64 = WrappingUint<uint64_t>

64-bit wrapping unsigned integer.

Definition at line 267 of file wrapping_uint.hpp.

◆ WrappingUint8

using rav::WrappingUint8 = WrappingUint<uint8_t>

8-bit wrapping unsigned integer.

Definition at line 258 of file wrapping_uint.hpp.

Enumeration Type Documentation

◆ AudioEncoding

enum class rav::AudioEncoding : uint8_t
strong
Enumerator
undefined 
pcm_s8 
pcm_u8 
pcm_s16 
pcm_s24 
pcm_s32 
pcm_f32 
pcm_f64 

Definition at line 33 of file audio_encoding.hpp.

◆ SafeIntError

enum class rav::SafeIntError
strong
Enumerator
overflow 
underflow 
div_by_zero 

Definition at line 33 of file safe_int.hpp.

Function Documentation

◆ audio_encoding_bytes_per_sample()

uint8_t rav::audio_encoding_bytes_per_sample ( const AudioEncoding encoding)
inline
Returns
The number of bytes per sample.

Definition at line 47 of file audio_encoding.hpp.

◆ audio_encoding_from_string()

std::optional< AudioEncoding > rav::audio_encoding_from_string ( const char * str)
inline

Definition at line 109 of file audio_encoding.hpp.

◆ audio_encoding_ground_value()

uint8_t rav::audio_encoding_ground_value ( const AudioEncoding encoding)
inline
Returns
The ground value for the encoding.

Definition at line 70 of file audio_encoding.hpp.

◆ create_rtp_receiver_parameters()

tl::expected< rtp::AudioReceiver::ReaderParameters, std::string > rav::create_rtp_receiver_parameters ( const sdp::SessionDescription & sdp)

Creates rtp receiver parameters from the given SDP.

Parameters
sdpThe SDP to create the parameters from.
Returns
The rtp receiver parameters, or an error message if the SDP is invalid.

◆ do_system_checks()

void rav::do_system_checks ( )
inline

Definition at line 33 of file system.hpp.

◆ generate_array()

template<typename T, std::size_t N, typename F>
std::array< T, N > rav::generate_array ( F && f)

Helper function to initialize std::array with non-copyable types.

Definition at line 73 of file stl_helpers.hpp.

◆ generate_array_impl()

template<typename T, std::size_t N, typename F, std::size_t... Is>
std::array< T, N > rav::generate_array_impl ( F && f,
std::index_sequence< Is... >  )

Definition at line 65 of file stl_helpers.hpp.

◆ get_env()

std::optional< std::string > rav::get_env ( const char * name)
inline

Gets the value of an environment variable.

Parameters
nameThe name of the variable to retrieve. Pointer must be non-null and \0 terminated.
Returns
The environment variable value, or an empty optional if the variable was not found.

Definition at line 45 of file env.hpp.

◆ get_global_const_instance_of_type()

template<typename T>
const T & rav::get_global_const_instance_of_type ( )

This function returns a reference to a read-only, default-constructed static object of type T.

There will be exactly one of these objects present per instantiated type, per process.

Definition at line 44 of file support.hpp.

◆ get_global_instance_of_type()

template<typename T>
T & rav::get_global_instance_of_type ( )

This function returns a reference to a read/write, default-constructed static object of type T.

There will be exactly one of these objects present per instantiated type, per process.

Definition at line 34 of file support.hpp.

◆ is_between()

template<typename T>
bool rav::is_between ( T a,
T min,
T max )

Tests if a value is between two other values, inclusive.

Template Parameters
TThe type of the values to compare.
Parameters
aThe value to test.
minThe minimum value.
maxThe maximum value.
Returns
True if the value is between the minimum and maximum values, false otherwise.

Definition at line 66 of file util.hpp.

◆ is_little_endian_at_runtime()

bool rav::is_little_endian_at_runtime ( )
inlinenoexcept

Checks if the system is little-endian at runtime.

Returns
True if the system is little-endian, false otherwise.

Definition at line 265 of file byte_order.hpp.

◆ is_within()

template<typename T>
bool rav::is_within ( T a,
T b,
T tolerance )

Tests if two values are within a certain tolerance of each other.

Template Parameters
TThe type of the values to compare.
Parameters
aThe first value.
bThe second value.
toleranceThe tolerance.
Returns
True if the values are within the tolerance of each other, false otherwise.

Definition at line 53 of file util.hpp.

◆ num_elements_in_array()

template<typename Type, size_t N>
size_t rav::num_elements_in_array ( Type(&) [N])
constexprnoexcept

Returns the number of elements in a c-style array.

Template Parameters
TypeThe type of the elements.
NThe total number of elements.
Returns
The number of elements in the array.

Definition at line 40 of file util.hpp.

◆ operator<<()

std::ostream & rav::operator<< ( std::ostream & os,
const PathMatcher::Error err )
inline

Definition at line 225 of file path_matcher.hpp.

◆ parse_json()

template<typename T>
boost::system::result< T > rav::parse_json ( const std::string_view json_str)

Definition at line 47 of file json.hpp.

◆ parse_network_interface_config_from_string()

std::optional< NetworkInterfaceConfig > rav::parse_network_interface_config_from_string ( const std::string & input,
const char delimiter = ',' )
inline

Definition at line 186 of file network_interface_config.hpp.

◆ read_be()

template<typename Type, std::enable_if_t< std::is_trivially_copyable_v< Type >, bool > = true>
Type rav::read_be ( const uint8_t * data)

Reads a big-endian value from the given data.

Template Parameters
TypeThe type of the value to read.
Parameters
dataThe data which holds the encoded value.
Returns
The decoded value.

Definition at line 213 of file byte_order.hpp.

◆ read_le()

template<typename Type, std::enable_if_t< std::is_trivially_copyable_v< Type >, bool > = true>
Type rav::read_le ( const uint8_t * data)

Reads a little-endian value from the given data.

Template Parameters
TypeThe type of the value to read.
Parameters
dataThe data which holds the encoded value.
Returns
The decoded value.

Definition at line 224 of file byte_order.hpp.

◆ read_ne()

template<typename Type, std::enable_if_t< std::is_trivially_copyable_v< Type >, bool > = true>
Type rav::read_ne ( const uint8_t * data)

Reads a value from the given data in native byte order (not to be confused with network-endian).

Template Parameters
TypeThe type of the value to read.
Parameters
dataThe data which holds the encoded value.
Returns
The decoded value.

Definition at line 200 of file byte_order.hpp.

◆ receive_from_socket()

size_t rav::receive_from_socket ( boost::asio::ip::udp::socket & socket,
std::array< uint8_t, 1500 > & data_buf,
boost::asio::ip::udp::endpoint & src_endpoint,
boost::asio::ip::udp::endpoint & dst_endpoint,
uint64_t & recv_time,
boost::system::error_code & ec )
nodiscard

◆ set_log_level()

void rav::set_log_level ( const char * level)
inline

Sets the log level for the application based on the given string.

The following are valid values:

  • TRACE
  • DEBUG
  • INFO (default)
  • WARN
  • ERROR
  • CRITICAL
  • OFF
    Parameters
    levelThe log level as string, case-insensitive.

Definition at line 160 of file log.hpp.

◆ set_log_level_from_env()

void rav::set_log_level_from_env ( const char * env_var = "RAV_LOG_LEVEL")
inline

Tries to find given environment variable and set the log level accordingly.

The following are valid values for the log level:

  • TRACE
  • DEBUG
  • INFO (default)
  • WARN
  • ERROR
  • CRITICAL
  • OFF By default the log level is set to INFO. If an invalid loglevel is passed, the loglevel will be set to INFO.
    Parameters
    env_varThe environment variable to read the log level from.

Definition at line 216 of file log.hpp.

◆ stl_get_or_default()

template<typename Map, typename Key>
auto rav::stl_get_or_default ( const Map & map,
const Key & key ) -> typename Map::mapped_type

Convenience function to get an item from a map, or if the item doesn't exist return a default value.

Template Parameters
MapThe type of the map.
KeyThe key type.
Parameters
mapThe map to get the item from.
keyThe key of the item to get.
Returns
The item, or a default constructed value.

Definition at line 57 of file stl_helpers.hpp.

◆ stl_remove_if()

template<typename Container, typename Pred>
size_t rav::stl_remove_if ( Container & container,
Pred pred )

Convenience function to remove items from an stl container which match pred.

Template Parameters
ContainerThe container type.
PredThe predicate type.
Parameters
containerThe container to remove item(s) from.
predThe predicate. If it returns true the item will be removed.
Returns
Number of elements removed.

Definition at line 42 of file stl_helpers.hpp.

◆ string_compare_case_insensitive()

bool rav::string_compare_case_insensitive ( const std::string_view lhs,
const std::string_view rhs )
inline

Compares 2 strings case-insensitively.

Parameters
lhsLeft hand side
rhsRight hand side
Returns
True if strings are equal, false otherwise.

Definition at line 430 of file string.hpp.

◆ string_contains() [1/2]

bool rav::string_contains ( const std::string_view string,
char c )
inline

Returns whether given string contains a certain character.

Parameters
stringString to look into.
cCharacter to find.
Returns
True if character was found, of false if character was not found.

Definition at line 327 of file string.hpp.

◆ string_contains() [2/2]

bool rav::string_contains ( const std::string_view string,
const std::string_view sub_string )
inline

Returns whether given string contains a certain substring.

Parameters
stringString to look into.
sub_stringSubstring to find.
Returns
True if substring was found, of false if substring was not found.

Definition at line 339 of file string.hpp.

◆ string_ends_with()

bool rav::string_ends_with ( const std::string_view text,
const std::string_view ends_with )
inline

Tests whether given text ends with a certain string.

Parameters
textThe text to test.
ends_withThe string to test for.
Returns
True if text ends with ends_with, false otherwise.

Definition at line 314 of file string.hpp.

◆ string_from_first_occurrence_of()

std::string_view rav::string_from_first_occurrence_of ( std::string_view string_to_search_in,
const std::string_view string_to_search_for,
const bool include_sub_string_in_result )
inline

Returns a string truncated starting from to first last occurrence of a needle.

Parameters
string_to_search_inString to search in.
string_to_search_forString to search for.
include_sub_string_in_resultIf true the needle will be included in the resulting string, when false it will not.
Returns
The truncated string, or an empty string when no needle was found.

Definition at line 113 of file string.hpp.

◆ string_from_last_occurrence_of()

std::string_view rav::string_from_last_occurrence_of ( const std::string_view string_to_search_in,
const std::string_view string_to_search_for,
const bool include_sub_string_in_result )
inline

Returns a string truncated starting from to last occurrence of a needle.

Parameters
string_to_search_inString to search in.
string_to_search_forString to search for.
include_sub_string_in_resultIf true the needle will be included in the resulting string, when false it will not.
Returns
The truncated string, or an empty string when no needle was found.

Definition at line 162 of file string.hpp.

◆ string_from_nth_occurrence_of()

std::string_view rav::string_from_nth_occurrence_of ( const size_t nth,
std::string_view string_to_search_in,
const std::string_view string_to_search_for,
const bool include_sub_string_in_result )
inline

Returns a string truncated from the nth occurrence of a needle.

Parameters
nthNth needle to find, 0 will always return the full string, 1 will find the 1st needle, and so on.
string_to_search_inString to search in.
string_to_search_forString to search for.
include_sub_string_in_resultIf true the needle will be included in the resulting string, when false it will not.
Returns
The truncated string, or an empty string when no needle was found.

Definition at line 133 of file string.hpp.

◆ string_remove_prefix()

std::string_view rav::string_remove_prefix ( const std::string_view & string,
const std::string_view prefix_to_remove,
bool * found = nullptr )
inline

Returns a copy of string with given prefix removed, if prefix is found at the beginning of the string.

Parameters
stringString to remove prefix from.
prefix_to_removePrefix to find and remove.
foundIf not null, will be set to true if the prefix was found and removed, false otherwise.
Returns
The string with the prefix removed, or the original string if the suffix was not found.

Definition at line 182 of file string.hpp.

◆ string_remove_suffix()

std::string_view rav::string_remove_suffix ( const std::string_view & string,
const std::string_view suffix_to_remove,
bool * found = nullptr )
inline

Returns a copy of string with given suffix removed, if suffix is found at the end of the string.

Parameters
stringString to remove suffix from.
suffix_to_removeSuffix to find and remove.
Returns
The string with the suffix removed, or the original string if the suffix was not found.

Definition at line 206 of file string.hpp.

◆ string_replace()

std::string rav::string_replace ( const std::string_view original,
const std::string_view to_replace,
const std::string_view replacement )
inline

Replaces all sequences of to_replace with replacement.

Parameters
originalThe original string,
to_replaceThe sequence to replace.
replacementThe replacement.
Returns
Modified string, or original string if sequence was not found.

Definition at line 387 of file string.hpp.

◆ string_split() [1/2]

std::vector< std::string > rav::string_split ( const std::string & string,
const char * delimiter )
inline

Splits a string into a vector of strings based on a delimiter.

Parameters
stringThe string to split.
delimiterThe delimiter to split the string by.
Returns
A vector of strings.

Definition at line 349 of file string.hpp.

◆ string_split() [2/2]

std::vector< std::string > rav::string_split ( const std::string & string,
const char delimiter )
inline

Splits a string into a vector of strings based on a delimiter.

Parameters
stringThe string to split.
delimiterThe delimiter to split the string by.
Returns
A vector of strings.

Definition at line 375 of file string.hpp.

◆ string_starts_with()

bool rav::string_starts_with ( const std::string_view text,
const std::string_view starts_with )
inline

Tests whether given text starts with a certain string.

Parameters
textThe text to test.
starts_withThe string to test for.
Returns
True if text starts with starts_with, false otherwise.

Definition at line 304 of file string.hpp.

◆ string_to_double()

std::optional< double > rav::string_to_double ( const std::string & str)
inline

String to double - converts a string to a double, or returns an empty optional if the conversion failed.

Parameters
strString to convert.
Returns
The converted double, or an empty optional if the conversion failed.

Definition at line 290 of file string.hpp.

◆ string_to_float()

std::optional< float > rav::string_to_float ( const std::string & str)
inline

String to float - converts a string to a float, or returns an empty optional if the conversion failed.

Parameters
strString to convert.
Returns
The converted float, or an empty optional if the conversion failed.

Definition at line 277 of file string.hpp.

◆ string_to_int()

template<typename Type>
std::enable_if_t< std::is_integral_v< Type >, std::optional< Type > > rav::string_to_int ( std::string_view string,
const bool strict = false,
const int base = 10 )

String to number - a small convenience function around std::from_chars.

Template Parameters
TypeType of the value to convert from a string.
Parameters
stringString to convert to a value.
strictIf true, the whole string must be a number, otherwise only the beginning of the string must be a number.
baseBase of the number to convert. When 16, the "0x" and "0X" prefixes are not recognized.
Returns
The converted value as optional, which will contain a value on success or will be empty on failure.

Definition at line 264 of file string.hpp.

◆ string_to_lower()

std::string rav::string_to_lower ( const std::string & str,
std::size_t count = std::numeric_limits<size_t>::max() )
inline

Converts the first count characters of a string to lower case.

Parameters
strThe string to convert.
countThe number of leading characters to convert to lower case.
Returns
A new string with the first count characters converted to lower case.

Definition at line 468 of file string.hpp.

◆ string_to_upper()

std::string rav::string_to_upper ( const std::string & str,
std::size_t count = std::numeric_limits<size_t>::max() )
inline

Converts the first count characters of a string to upper case.

Parameters
strThe string to convert.
countThe number of leading characters to convert to upper case.
Returns
A new string with the first count characters converted to upper case.

Definition at line 450 of file string.hpp.

◆ string_trim()

std::string_view rav::string_trim ( const std::string_view input)
inline

Trims given string by removing whitespace at the start and the end or the string.

Parameters
inputThe input to trim.
Returns
The trimmed string, or the original is no trimming was needed.

Definition at line 228 of file string.hpp.

◆ string_unquoted()

std::string_view rav::string_unquoted ( std::string_view input)
inline

If given string is quoted, it will remove the quotes.

It will also trim the strim before doing that. If there are unmatched quoted ('some"), nothing will happen.

Parameters
inputThe input to unquote.
Returns
The unquoted string.

Definition at line 405 of file string.hpp.

◆ string_up_to_first_occurrence_of()

std::string_view rav::string_up_to_first_occurrence_of ( std::string_view string_to_search_in,
const std::string_view string_to_search_for,
const bool include_sub_string_in_result )
inline

Returns a string truncated up to the first occurrence of a needle.

Parameters
string_to_search_inString to search in.
string_to_search_forString to search for.
include_sub_string_in_resultIf true the needle will be included in the resulting string, when false it will not.
Returns
The truncated string, or an empty string when no needle was found.

Definition at line 45 of file string.hpp.

◆ string_up_to_last_occurrence_of()

std::string_view rav::string_up_to_last_occurrence_of ( const std::string_view string_to_search_in,
const std::string_view string_to_search_for,
const bool include_sub_string_in_result )
inline

Returns a string truncated up to the last occurrence of a needle.

Parameters
string_to_search_inString to search in.
string_to_search_forString to search for.
include_sub_string_in_resultIf true the needle will be included in the resulting string, when false it will not.
Returns
The truncated string, or an empty string when no needle was found.

Definition at line 94 of file string.hpp.

◆ string_up_to_the_nth_occurrence_of()

std::string_view rav::string_up_to_the_nth_occurrence_of ( const size_t nth,
std::string_view string_to_search_in,
const std::string_view string_to_search_for,
const bool include_sub_string_in_result )
inline

Returns a string truncated up to the nth occurrence of a needle.

Parameters
nthNth needle to find, 0 will always return an empty string, 1 will find the 1st needle, and so on.
string_to_search_inString to search in.
string_to_search_forString to search for.
include_sub_string_in_resultIf true the needle will be included in the resulting string, when false it will not.
Returns
The truncated string, or an empty string when no needle was found.

Definition at line 65 of file string.hpp.

◆ swap_bytes() [1/3]

template<typename Type, std::enable_if_t< std::is_trivially_copyable_v< Type >, bool > = true>
Type rav::swap_bytes ( Type value)
Template Parameters
TypeThe type of the value to swap.
Parameters
valueThe value to swap.
Returns
The value with the bytes swapped.

Definition at line 111 of file byte_order.hpp.

◆ swap_bytes() [2/3]

void rav::swap_bytes ( uint8_t * data,
const size_t size )
inline

Swaps given amount of bytes in the given data, in place.

Parameters
dataThe data to swap.
sizeThe size of the data (in bytes).

Definition at line 75 of file byte_order.hpp.

◆ swap_bytes() [3/3]

void rav::swap_bytes ( uint8_t * data,
const size_t size,
const size_t stride )
inline

Swaps given amount of bytes in the given data, in place, with the given stride.

Parameters
dataThe data to swap.
sizeThe size of the data (in bytes).
strideThe stride of the data (in bytes).

Definition at line 92 of file byte_order.hpp.

◆ swap_bytes< double >()

template<>
double rav::swap_bytes< double > ( const double value)
inline

Specialization of swap_bytes for doubles.

Parameters
valueThe value to swap.
Returns
The value with the bytes swapped.

Definition at line 151 of file byte_order.hpp.

◆ swap_bytes< float >()

template<>
float rav::swap_bytes< float > ( const float value)
inline

Specialization of swap_bytes for floats.

Parameters
valueThe value to swap.
Returns
The value with the bytes swapped.

Definition at line 133 of file byte_order.hpp.

◆ swap_if_be()

template<typename Type, std::enable_if_t< std::is_trivially_copyable_v< Type >, bool > = true>
Type rav::swap_if_be ( const Type value)

Swaps the bytes of the given value if the system is big-endian.

Template Parameters
TypeThe type of the value to swap.
Parameters
valueThe value to swap.
Returns
The value with the bytes swapped.

Definition at line 185 of file byte_order.hpp.

◆ swap_if_le()

template<typename Type, std::enable_if_t< std::is_trivially_copyable_v< Type >, bool > = true>
Type rav::swap_if_le ( const Type value)

Swaps the bytes of the given value if the system is little-endian.

Template Parameters
TypeThe type of the value to swap.
Parameters
valueThe value to swap.
Returns
The value with the bytes swapped.

Definition at line 170 of file byte_order.hpp.

◆ tag_invoke() [1/6]

void rav::tag_invoke ( const boost::json::value_from_tag & ,
boost::json::value & jv,
const RavennaReceiver::Configuration & config )

◆ tag_invoke() [2/6]

void rav::tag_invoke ( const boost::json::value_from_tag & ,
boost::json::value & jv,
const RavennaSender::Configuration & config )

◆ tag_invoke() [3/6]

void rav::tag_invoke ( const boost::json::value_from_tag & ,
boost::json::value & jv,
const RavennaSender::Destination & destination )

◆ tag_invoke() [4/6]

RavennaReceiver::Configuration rav::tag_invoke ( const boost::json::value_to_tag< RavennaReceiver::Configuration > & ,
const boost::json::value & jv )

◆ tag_invoke() [5/6]

RavennaSender::Configuration rav::tag_invoke ( const boost::json::value_to_tag< RavennaSender::Configuration > & ,
const boost::json::value & jv )

◆ tag_invoke() [6/6]

RavennaSender::Destination rav::tag_invoke ( const boost::json::value_to_tag< RavennaSender::Destination > & ,
const boost::json::value & jv )

◆ throw_exception_from_error()

BOOST_NORETURN BOOST_NOINLINE void rav::throw_exception_from_error ( PathMatcher::Error const & e,
boost::source_location const & loc )
inline

Definition at line 238 of file path_matcher.hpp.

◆ to_string() [1/2]

const char * rav::to_string ( const AudioEncoding encoding)
inline

Definition at line 86 of file audio_encoding.hpp.

◆ to_string() [2/2]

std::string rav::to_string ( const RavennaNode::Configuration & configuration)
Returns
A string representation of RavennaNode::Configuration.

◆ tracy_point()

void rav::tracy_point ( )
inline

Sometimes you want to know when something happened, but you don't want to instrument functions which get called into.

Then use this function to get a quick and dirty point in time.

Definition at line 58 of file tracy.hpp.

◆ validate_byte_order()

void rav::validate_byte_order ( )
inline

Validates whether the compiled byte order matches the runtime byte order.

If not throws an exception.

Definition at line 273 of file byte_order.hpp.

◆ write_be()

template<typename Type, std::enable_if_t< std::is_trivially_copyable_v< Type >, bool > = true>
void rav::write_be ( uint8_t * dst,
const Type value )

Writes a big-endian value to the given destination.

Template Parameters
TypeThe type of the value to write.
Parameters
dstThe destination where the value should be written.
valueThe value to write.

Definition at line 246 of file byte_order.hpp.

◆ write_le()

template<typename Type, std::enable_if_t< std::is_trivially_copyable_v< Type >, bool > = true>
void rav::write_le ( uint8_t * dst,
const Type value )

Writes a little-endian value to the given destination.

Template Parameters
TypeThe type of the value to write.
Parameters
dstThe destination where the value should be written.
valueThe value to write.

Definition at line 257 of file byte_order.hpp.

◆ write_ne()

template<typename Type, std::enable_if_t< std::is_trivially_copyable_v< Type >, bool > = true>
void rav::write_ne ( uint8_t * dst,
const Type value )

Writes a value to the given destination in native byte order (not to be confused with network-endian).

Template Parameters
TypeThe type of the value to write.
Parameters
dstThe destination where the value should be written.
valueThe value to write.

Definition at line 235 of file byte_order.hpp.

Variable Documentation

◆ big_endian

bool rav::big_endian = false
staticconstexpr

Definition at line 49 of file byte_order.hpp.

◆ little_endian

bool rav::little_endian = true
staticconstexpr

Definition at line 48 of file byte_order.hpp.