mavtables  0.2.1
MAVLink router and firewall.
Functions
Utility Functions

Functions

std::string to_lower (std::string string)
 
template<typename T >
std::vector< T >::iterator append (std::vector< T > &dest, const std::vector< T > &source)
 
template<typename T >
std::vector< T >::iterator append (std::vector< T > &dest, std::vector< T > &&source)
 
template<class T >
std::string str (const T &object)
 
template<class ByteType = unsigned char, class T >
std::array< ByteType, sizeof(T)> to_bytes (T number)
 
template<class T >
std::ostream & operator<< (std::ostream &os, const std::vector< T > &vector)
 

Detailed Description

Utility functions that don't warrant their own file.

Function Documentation

◆ append() [1/2]

template<typename T >
std::vector< T >::iterator append ( std::vector< T > &  dest,
const std::vector< T > &  source 
)

Append one vector to another.

Taken from https://stackoverflow.com/a/37210097

Parameters
destVector to append to.
sourceVector to append the elements from.
Returns
Iterator pointing to the first element appended, or the end of the destination vector if the source vector is empty.

Definition at line 64 of file utility.hpp.

◆ append() [2/2]

template<typename T >
std::vector< T >::iterator append ( std::vector< T > &  dest,
std::vector< T > &&  source 
)

Append one vector to another (move from source).

Taken from https://stackoverflow.com/a/37210097

Parameters
destVector to append to.
sourceVector to append the elements from. source will be a valid empty vector after this call.
Returns
Iterator pointing to the first element appended, or the end of the destination vector if the source vector is empty.

Definition at line 96 of file utility.hpp.

◆ operator<<()

template<class T >
std::ostream & operator<< ( std::ostream &  os,
const std::vector< T > &  vector 
)

Print a vector to the given output stream.

Template Parameters
TThe type stored in the vector, it must support the << operator.
Parameters
osThe output stream to print to.
vectorThe vector of elements to print.
Returns
The output stream.

Definition at line 168 of file utility.hpp.

◆ str()

template<class T >
std::string str ( const T &  object)

Convert any object supporting the output stream operator (<<) to a string.

Template Parameters
TType of the object to convert to a string.
Parameters
objectThe object to convert to a string.
Returns
The string representing the object.

Definition at line 128 of file utility.hpp.

Here is the caller graph for this function:

◆ to_bytes()

template<class ByteType = unsigned char, class T >
std::array< ByteType, sizeof(T)> to_bytes ( number)

Convert numeric types to bytes.

Template Parameters
ByteTypeNumeric type to return in the array of bytes.
TType of the number being converted to bytes.
Parameters
numberNumber to convert to bytes
Returns
The array of bytes from the given number, in LSB order.

Definition at line 145 of file utility.hpp.

Here is the caller graph for this function:

◆ to_lower()

std::string to_lower ( std::string  string)

Convert string to lower case.

Parameters
stringThe string to convert to lower case.
Returns
The string converted to lower case.

Definition at line 37 of file utility.cpp.

Here is the caller graph for this function: