VISR  0.11.1
Versatile Interactive Scene Renderer
visr::rbbl::SparseGainRoutingList Class Reference

#include <sparse_gain_routing.hpp>

Inheritance diagram for visr::rbbl::SparseGainRoutingList:
visr::pml::SparseGainRoutingListParameter

Classes

class  CompareEntries
 

Public Types

using IndexType = SparseGainRouting::IndexType
 
using RoutingsType = std::set< SparseGainRouting, CompareEntries >
 

Public Member Functions

 SparseGainRoutingList ()
 
 SparseGainRoutingList (std::initializer_list< SparseGainRouting > const &entries)
 
 SparseGainRoutingList (const SparseGainRoutingList &rhs)
 
SparseGainRoutingListoperator= (const SparseGainRoutingList &rhs)
 
void clear ()
 
void swap (SparseGainRoutingList &rhs)
 
bool empty () const
 
std::size_t size () const
 
RoutingsType::const_iterator begin () const
 
RoutingsType::const_iterator end () const
 
void addRouting (SparseGainRouting::IndexType entryIdx, SparseGainRouting::IndexType rowIdx, SparseGainRouting::IndexType columnIdx, SparseGainRouting::GainType gain=0.0f)
 
void addRouting (SparseGainRouting const &newEntry)
 
bool removeRouting (IndexType const &entryIndex)
 
bool removeRouting (SparseGainRouting const &entry)
 
bool removeRouting (IndexType inputIdx, IndexType outputIdx)
 
SparseGainRouting const & getEntry (IndexType entryIdx) const
 
void parseJson (std::string const &encoded)
 
void parseJson (std::istream &encoded)
 

Static Public Member Functions

static SparseGainRoutingList const fromJson (std::string const &initString)
 
static SparseGainRoutingList 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::SparseGainRoutingList::SparseGainRoutingList ( )
default

Default constructor, creates an empty list

visr::rbbl::SparseGainRoutingList::SparseGainRoutingList ( std::initializer_list< SparseGainRouting > 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 SparseGainRouting structs.
visr::rbbl::SparseGainRoutingList::SparseGainRoutingList ( const SparseGainRoutingList rhs)
default

Copy constructor

Parameters
rhsThe object to be copied.

Member Function Documentation

void visr::rbbl::SparseGainRoutingList::addRouting ( SparseGainRouting::IndexType  entryIdx,
SparseGainRouting::IndexType  rowIdx,
SparseGainRouting::IndexType  columnIdx,
SparseGainRouting::GainType  gain = 0.0f 
)
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
entryIdxUnique index of the entry (zero-offset).
rowIdxRow of the output channel (zero-offset).
columnIdxColumn index of the routing point (zero-offset).
gainGain value of the routing entry, linear scale. Default: 1.0
void visr::rbbl::SparseGainRoutingList::addRouting ( SparseGainRouting 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::SparseGainRoutingList::begin ( ) const
inline
void visr::rbbl::SparseGainRoutingList::clear ( )

Empty the routing list.

bool visr::rbbl::SparseGainRoutingList::empty ( ) const
inline

Query whether the object contains no routings.

Returns
true if the onbject is empty, false otherwise.
RoutingsType::const_iterator visr::rbbl::SparseGainRoutingList::end ( ) const
inline
SparseGainRoutingList const visr::rbbl::SparseGainRoutingList::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
SparseGainRoutingList const visr::rbbl::SparseGainRoutingList::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
SparseGainRouting const& visr::rbbl::SparseGainRoutingList::getEntry ( IndexType  entryIdx) const
inline

Return a routing entry for a given entry index.

Parameters
entryIdxThe 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.
SparseGainRoutingList & visr::rbbl::SparseGainRoutingList::operator= ( const SparseGainRoutingList rhs)
default

Assign the content from another SparseGainRoutingList object.

Parameters
rhsThe object whose contents is copied to this object.
void visr::rbbl::SparseGainRoutingList::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::SparseGainRoutingList::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::SparseGainRoutingList::removeRouting ( IndexType const &  entryIndex)

Remove a routing entry speficied by the entry. The filterIndex and gainValue attributes of entry are ignored.

Parameters
entryIndexThe entry index of routing entry to be removed.
Returns
true if the removal was successful, and false if no element has been removed.
bool visr::rbbl::SparseGainRoutingList::removeRouting ( SparseGainRouting 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 (specified 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::SparseGainRoutingList::removeRouting ( SparseGainRouting::IndexType  inputIdx,
SparseGainRouting::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::SparseGainRoutingList::size ( ) const
inline

Return the number of contained routings.

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

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

Parameters
rhsThe object to be swapped with.

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