![]() |
VISR
0.11.8
Versatile Interactive Scene Renderer
|
#include <filter_routing.hpp>
Classes | |
class | CompareEntries |
Public Types | |
using | IndexType = FilterRouting::IndexType |
using | RoutingsType = std::set< FilterRouting, CompareEntries > |
Public Member Functions | |
FilterRoutingList () | |
FilterRoutingList (std::initializer_list< FilterRouting > const &entries) | |
FilterRoutingList (const FilterRoutingList &rhs)=default | |
void | swap (FilterRoutingList &rhs) |
bool | empty () const |
std::size_t | size () const |
FilterRoutingList & | operator= (FilterRoutingList const &rhs)=default |
RoutingsType::const_iterator | begin () const |
RoutingsType::const_iterator | end () const |
void | addRouting (FilterRouting::IndexType inputIdx, FilterRouting::IndexType outputIdx, FilterRouting::IndexType filterIdx, FilterRouting::GainType gain=0.0) |
void | addRouting (FilterRouting const &newEntry) |
bool | removeRouting (FilterRouting const &entry) |
bool | removeRouting (IndexType inputIdx, IndexType outputIdx) |
FilterRouting const & | getEntry (IndexType inputIdx, IndexType outputIdx) const |
void | parseJson (std::string const &encoded) |
void | parseJson (std::istream &encoded) |
Static Public Member Functions | |
static FilterRoutingList const | fromJson (std::string const &initString) |
static FilterRoutingList const | fromJson (std::istream &initStream) |
Class to contain and manipulate a list of routing entries.
using visr::rbbl::FilterRoutingList::RoutingsType = std::set< FilterRouting, CompareEntries > |
Data type used for representing routings.
|
inline |
Default constructor, creates an empty list
visr::rbbl::FilterRoutingList::FilterRoutingList | ( | std::initializer_list< FilterRouting > const & | entries | ) |
Create a routing list from an C++11 initialiser list in a C++ source file.
entries | Initialiser list consisting of a list of FilterRouting structs. |
|
default |
Copy constructor
rhs | The object to be copied. |
|
inline |
Set a new routing using specified by single parameters. In case an entry already exists for this input-output routing, it is replaced by the new one.
inputIdx | Index of the input channel (zero-offset) |
outputIdx | Index of the output channel (zero-offset) |
filterIdx | Index of the filter (zero-offset) |
gain | Gain value of the routing entry, linear scale. Default: 1.0 |
void visr::rbbl::FilterRoutingList::addRouting | ( | FilterRouting const & | newEntry | ) |
Add a new routing entry. If a routing for this input-output combination already exists, it is replaced by the new one.
newEntry | The new routing entry. |
std::logic_error | If the insertion fails for any reason. |
|
inline |
|
inline |
Query whether the object contains no routings.
|
inline |
|
static |
Construct an object from an JSON initialiser string following the 'named constructor' idiom.
initString | A string containing a JSON array of filter routing points |
|
static |
Construct an object from a JSON string provided in an istream object. This function represents a named constructor.
initStream | An input stream containing a JSON array with FilterReoutingParameter elements. |
|
inline |
Return a routing entry for a given pair of input and output index.
inputIdx | The input index of the reuested routing entry. |
outputIdx | The output index of the reuested routing entry. |
|
default |
Assign the content from another FilterRoutingList object.
rhs | The object whose contents is copied to this object. |
void visr::rbbl::FilterRoutingList::parseJson | ( | std::string const & | encoded | ) |
Parse a JSON string containing a routing specification. The top-level JSON object must be an array of elements in the form { "input": nn, "output": nn, "filter": nn, "gain": x.x }, whereas the element "gain" is optional with a default value of 1.0. Each of the entries "input", "output", "filter" might be either scalars of init lists according to the syntax defined by IndexSequence and FloatSequence, respectively. If more than one entry is non-scala, the other entries must be scalar or have the same size as the former. In this case, the scalar entries are repeated to form sequences of the same length as the non-scalar ones. A routing entry is generated for each set of corresponding sequence elements. The previous content is erased if the operation is successful.
encoded | A string containing a JSON message. |
std::invalid_argument | If the parsing fails. In this case, the state prior to the call is retained (strong exception safety) |
void visr::rbbl::FilterRoutingList::parseJson | ( | std::istream & | encoded | ) |
Parse a JSON string containing a routing specification from an input stream. The top-level JSON object must be an array of elements in the form { "input": nn, "output": nn, "filter": nn, "gain": x.x }, whereas the element "gain" is optional with a default value of 1.0. Each of the entries "input", "output", "filter" might be either scalars of init lists according to the syntax defined by IndexSequence and FloatSequence, respectively. If more than one entry is non-scala, the other entries must be scalar or have the same size as the former. In this case, the scalar entries are repeated to form sequences of the same length as the non-scalar ones. A routing entry is generated for each set of corresponding sequence elements. The previous content is erased if the operation is successful.
encoded | A string containing a JSON message. |
std::invalid_argument | If the parsing fails. In this case, the state prior to the call is retained (strong exception safety) |
bool visr::rbbl::FilterRoutingList::removeRouting | ( | FilterRouting const & | entry | ) |
Remove a routing entry speficied by the input and output indices of entry
. The filterIndex and gainValue attributes of entry
are ignored.
entry | The routing entry (spcified by the input and output index) to be removed. |
true
if the removal was successful, and false
if no element has been removed. bool visr::rbbl::FilterRoutingList::removeRouting | ( | FilterRouting::IndexType | inputIdx, |
FilterRouting::IndexType | outputIdx | ||
) |
Remove a routing entry speficied by the input and the output index.
inputIdx | The input index of the routing to be removed. |
outputIdx | The output index of the routing to be removed. |
true
if the removal was successful, and false
if no element has been removed.
|
inline |
Return the number of contained routings.
void visr::rbbl::FilterRoutingList::swap | ( | FilterRoutingList & | rhs | ) |
Exchange the contents with another FilterRoutingList object. Does not throw exceptions.
rhs | The object to be swapped with. |