VISR  0.12.0
Versatile Interactive Scene Renderer
visr::rbbl::FilterRoutingList Class Reference

#include <filter_routing.hpp>

Inheritance diagram for visr::rbbl::FilterRoutingList:
visr::pml::FilterRoutingListParameter

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
 
FilterRoutingListoperator= (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)
 

Detailed Description

Class to contain and manipulate a list of routing entries.

Member Typedef Documentation

Data type used for representing routings.

Constructor & Destructor Documentation

visr::rbbl::FilterRoutingList::FilterRoutingList ( )
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.

Parameters
entriesInitialiser list consisting of a list of FilterRouting structs.
visr::rbbl::FilterRoutingList::FilterRoutingList ( const FilterRoutingList rhs)
default

Copy constructor

Parameters
rhsThe object to be copied.

Member Function Documentation

void visr::rbbl::FilterRoutingList::addRouting ( FilterRouting::IndexType  inputIdx,
FilterRouting::IndexType  outputIdx,
FilterRouting::IndexType  filterIdx,
FilterRouting::GainType  gain = 0.0 
)
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.

Parameters
inputIdxIndex of the input channel (zero-offset)
outputIdxIndex of the output channel (zero-offset)
filterIdxIndex of the filter (zero-offset)
gainGain 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.

Parameters
newEntryThe new routing entry.
Exceptions
std::logic_errorIf the insertion fails for any reason.
RoutingsType::const_iterator visr::rbbl::FilterRoutingList::begin ( ) const
inline
bool visr::rbbl::FilterRoutingList::empty ( ) const
inline

Query whether the object contains no routings.

Returns
true if the onbject is empty, false otherwise.
RoutingsType::const_iterator visr::rbbl::FilterRoutingList::end ( ) const
inline
FilterRoutingList const visr::rbbl::FilterRoutingList::fromJson ( std::string const &  initString)
static

Construct an object from an JSON initialiser string following the 'named constructor' idiom.

Parameters
initStringA string containing a JSON array of filter routing points
See also
parseJson
FilterRoutingList const visr::rbbl::FilterRoutingList::fromJson ( std::istream &  initStream)
static

Construct an object from a JSON string provided in an istream object. This function represents a named constructor.

Parameters
initStreamAn input stream containing a JSON array with FilterReoutingParameter elements.
See also
parseJson
FilterRouting const& visr::rbbl::FilterRoutingList::getEntry ( IndexType  inputIdx,
IndexType  outputIdx 
) const
inline

Return a routing entry for a given pair of input and output index.

Parameters
inputIdxThe input index of the reuested routing entry.
outputIdxThe output index of the reuested routing entry.
Returns
A reference to the requested routing entry, or a reference to an object with invalidated index entries if the specified roputing is not found.
FilterRoutingList& visr::rbbl::FilterRoutingList::operator= ( FilterRoutingList const &  rhs)
default

Assign the content from another FilterRoutingList object.

Parameters
rhsThe 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.

Parameters
encodedA string containing a JSON message.
Exceptions
std::invalid_argumentIf 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.

Parameters
encodedA string containing a JSON message.
Exceptions
std::invalid_argumentIf 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.

Parameters
entryThe routing entry (spcified by the input and output index) to be removed.
Returns
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.

Parameters
inputIdxThe input index of the routing to be removed.
outputIdxThe output index of the routing to be removed.
Returns
true if the removal was successful, and false if no element has been removed.
std::size_t visr::rbbl::FilterRoutingList::size ( ) const
inline

Return the number of contained routings.

Returns
Number of current routings.
void visr::rbbl::FilterRoutingList::swap ( FilterRoutingList rhs)

Exchange the contents with another FilterRoutingList object. Does not throw exceptions.

Parameters
rhsThe object to be swapped with.

The documentation for this class was generated from the following files: