![]() |
VISR
0.11.8
Versatile Interactive Scene Renderer
|
#include <sparse_gain_routing.hpp>
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) | |
SparseGainRoutingList & | operator= (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) |
Class to contain and manipulate a list of routing entries.
using visr::rbbl::SparseGainRoutingList::RoutingsType = std::set< SparseGainRouting, CompareEntries > |
Data type used for representing routings.
|
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.
entries | Initialiser list consisting of a list of SparseGainRouting 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.
entryIdx | Unique index of the entry (zero-offset). |
rowIdx | Row of the output channel (zero-offset). |
columnIdx | Column index of the routing point (zero-offset). |
gain | Gain 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.
newEntry | The new routing entry. |
std::logic_error | If the insertion fails for any reason. |
|
inline |
void visr::rbbl::SparseGainRoutingList::clear | ( | ) |
Empty the routing list.
|
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 entry index.
entryIdx | The index of the reuested routing entry. |
|
default |
Assign the content from another SparseGainRoutingList object.
rhs | The 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.
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::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.
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::SparseGainRoutingList::removeRouting | ( | IndexType const & | entryIndex | ) |
Remove a routing entry speficied by the entry
. The filterIndex and gainValue attributes of entry
are ignored.
entryIndex | The entry index of routing entry to be removed. |
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.
entry | The routing entry (specified 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::SparseGainRoutingList::removeRouting | ( | SparseGainRouting::IndexType | inputIdx, |
SparseGainRouting::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::SparseGainRoutingList::swap | ( | SparseGainRoutingList & | rhs | ) |
Exchange the contents with another SparseGainRoutingList object. Does not throw exceptions.
rhs | The object to be swapped with. |