VISR  0.12.0
Versatile Interactive Scene Renderer
visr::impl::ComponentImplementation Class Reference

#include <component_implementation.hpp>

Inheritance diagram for visr::impl::ComponentImplementation:
visr::impl::CompositeComponentImplementation

Public Types

template<class PortType >
using PortContainer = std::vector< PortType * >
 
using AudioPortContainer = PortContainer< AudioPortBaseImplementation >
 

Public Member Functions

 ComponentImplementation (visr::Component &component, SignalFlowContext const &context, char const *componentName, CompositeComponentImplementation *parent)
 
virtual ~ComponentImplementation ()
 
 ComponentImplementation ()=delete
 
 ComponentImplementation (ComponentImplementation const &)=delete
 
 ComponentImplementation (ComponentImplementation &&)=delete
 
ComponentImplementationoperator= (ComponentImplementation const &)=delete
 
ComponentImplementationoperator= (ComponentImplementation &&)=delete
 
std::string const & name () const
 
std::string fullName () const
 
virtual bool isComposite () const
 
SamplingFrequencyType samplingFrequency () const
 
std::size_t period () const
 
void registerParameterPort (ParameterPortBaseImplementation *port)
 
bool unregisterParameterPort (ParameterPortBaseImplementation *port)
 
ParameterPortContainer::iterator findParameterPortEntry (char const *portName)
 
ParameterPortContainer::const_iterator findParameterPortEntry (char const *portName) const
 
ParameterPortBase const * findParameterPort (char const *portName) const
 
ParameterPortBasefindParameterPort (char const *portName)
 
AudioPortBasefindAudioPort (char const *name)
 
AudioPortBase const * findAudioPort (char const *name) const
 
void status (StatusMessage::Kind statusId, char const *message)
 
bool isTopLevel () const
 
CompositeComponentImplementationparent ()
 
CompositeComponentImplementation const * parent () const
 
SignalFlowContext const & context () const
 
template<>
ComponentImplementation::PortContainer< AudioPortBaseImplementation > const & ports () const
 
template<>
ComponentImplementation::PortContainer< ParameterPortBaseImplementation > const & ports () const
 
template<>
ComponentImplementation::PortContainer< AudioPortBaseImplementation > & ports ()
 
template<>
ComponentImplementation::PortContainer< ParameterPortBaseImplementation > & ports ()
 
template<class PortType >
TypedPortContainer< PortType >::const_iterator findPortEntry (char const *portName) const
 
template<class PortType >
TypedPortContainer< PortType >::iterator findPortEntry (char const *portName)
 
AudioPortContainer const & audioPorts () const
 
AudioPortContaineraudioPorts ()
 
AudioPortContainer::const_iterator audioPortBegin () const
 
AudioPortContainer::const_iterator audioPortEnd () const
 
visr::Componentcomponent ()
 
visr::Component const & component () const
 

Static Public Attributes

static const std::string cNameSeparator = ":"
 

Friends

class AudioPortBaseImplementation
 
class ParameterPortBaseImplementation
 
class CompositeComponentImplementation
 

Related Functions

(Note that these are not member functions.)

template ComponentImplementation::PortContainer< AudioPortBaseImplementation >::const_iterator findPortEntry (char const *portName) const
 
template ComponentImplementation::PortContainer< ParameterPortBaseImplementation >::const_iterator findPortEntry (char const *portName) const
 
template ComponentImplementation::PortContainer< AudioPortBaseImplementation >::iterator findPortEntry (const char *portName)
 
template ComponentImplementation::PortContainer< ParameterPortBaseImplementation >::iterator findPortEntry (char const *portName)
 
using ParameterPortContainer = PortContainer< ParameterPortBaseImplementation >
 
ParameterPortContainer const & parameterPorts () const
 
ParameterPortContainerparameterPorts ()
 
ParameterPortContainer::const_iterator parameterPortBegin () const
 
ParameterPortContainer::const_iterator parameterPortEnd () const
 
ParameterPortContainer::iterator parameterPortBegin ()
 
ParameterPortContainer::iterator parameterPortEnd ()
 
template<class PortType >
PortContainer< PortType > const & ports () const
 
template<class PortType >
PortContainer< PortType > & ports ()
 
template<class PortType >
PortContainer< PortType >::iterator portBegin ()
 
template<class PortType >
PortContainer< PortType >::iterator portEnd ()
 
template<class PortType >
PortContainer< PortType >::const_iterator portBegin () const
 
template<class PortType >
PortContainer< PortType >::const_iterator portEnd () const
 
template<class PortType >
PortContainer< PortType >::const_iterator findPortEntry (char const *portName) const
 
template<class PortType >
PortContainer< PortType >::iterator findPortEntry (char const *portName)
 

Member Typedef Documentation

template<class PortType >
using visr::impl::ComponentImplementation::PortContainer = std::vector<PortType*>

Constructor & Destructor Documentation

visr::impl::ComponentImplementation::ComponentImplementation ( visr::Component component,
SignalFlowContext const &  context,
char const *  componentName,
CompositeComponentImplementation parent 
)
explicit
visr::impl::ComponentImplementation::~ComponentImplementation ( )
virtual
visr::impl::ComponentImplementation::ComponentImplementation ( )
delete
visr::impl::ComponentImplementation::ComponentImplementation ( ComponentImplementation const &  )
delete
visr::impl::ComponentImplementation::ComponentImplementation ( ComponentImplementation &&  )
delete

Member Function Documentation

AudioPortContainer::const_iterator visr::impl::ComponentImplementation::audioPortBegin ( ) const
inline
AudioPortContainer::const_iterator visr::impl::ComponentImplementation::audioPortEnd ( ) const
inline
AudioPortContainer const& visr::impl::ComponentImplementation::audioPorts ( ) const
inline

Allow access to the port lists

AudioPortContainer& visr::impl::ComponentImplementation::audioPorts ( )
inline
visr::Component& visr::impl::ComponentImplementation::component ( )
inline

Return a reference to the externally visible part of the component. This is required for atomic components to have their (overridden) process() method called.

Todo:
Maybe implement a separate impl::AtomicComponent class for that
visr::Component const& visr::impl::ComponentImplementation::component ( ) const
inline
SignalFlowContext const& visr::impl::ComponentImplementation::context ( ) const
inline
AudioPortBase * visr::impl::ComponentImplementation::findAudioPort ( char const *  name)
Returns
pointer to port, nullptr in case the port is not found.
AudioPortBase const * visr::impl::ComponentImplementation::findAudioPort ( char const *  name) const
Returns
pointer to port, nullptr in case the port is not found.
ParameterPortBase const * visr::impl::ComponentImplementation::findParameterPort ( char const *  portName) const
Returns
pointer to port, nullptr in case the port is not found.
ParameterPortBase * visr::impl::ComponentImplementation::findParameterPort ( char const *  portName)
Returns
pointer to port, nullptr in case the port is not found.
ComponentImplementation::ParameterPortContainer::iterator visr::impl::ComponentImplementation::findParameterPortEntry ( char const *  portName)

Find a named parameter port within the component and return an iterator into the port container.

Returns
A valid iterator into the port container for parameter ports, or the end() iterator if a port of this name is not found.
Todo:
Templatise these calls as well
ComponentImplementation::ParameterPortContainer::const_iterator visr::impl::ComponentImplementation::findParameterPortEntry ( char const *  portName) const

Find a named parameter port within the component and return an iterator into the port container, const verstion.

Returns
A valid iterator into the port container for parameter ports, or the end() iterator if a port of this name is not found.
Todo:
Templatise these calls as well
template<class PortType >
PortContainer<PortType>::const_iterator visr::impl::ComponentImplementation::findPortEntry ( char const *  portName) const
template<class PortType >
PortContainer<PortType>::iterator visr::impl::ComponentImplementation::findPortEntry ( char const *  portName)
template<class PortType >
TypedPortContainer<PortType>::const_iterator visr::impl::ComponentImplementation::findPortEntry ( char const *  portName) const
template<class PortType >
TypedPortContainer<PortType>::iterator visr::impl::ComponentImplementation::findPortEntry ( char const *  portName)
std::string visr::impl::ComponentImplementation::fullName ( ) const

Return the full, hierarchical name of the component.

bool visr::impl::ComponentImplementation::isComposite ( ) const
virtual

Query whether the corresponding component is atomic or composite.

Todo:
Check whether the current approach of storing this information in the class hierarchy of the externally visible components is the right way to go, or whether this information should be held local in the internal object.

Reimplemented in visr::impl::CompositeComponentImplementation.

bool visr::impl::ComponentImplementation::isTopLevel ( ) const
inline

Query whether the component is at the top level of a signal flow.

Note
Not needed for user API
std::string const & visr::impl::ComponentImplementation::name ( ) const

Return the 'local', non-hierarchical name.

ComponentImplementation& visr::impl::ComponentImplementation::operator= ( ComponentImplementation const &  )
delete
ComponentImplementation& visr::impl::ComponentImplementation::operator= ( ComponentImplementation &&  )
delete
ComponentImplementation::ParameterPortContainer::const_iterator visr::impl::ComponentImplementation::parameterPortBegin ( ) const
ComponentImplementation::ParameterPortContainer::iterator visr::impl::ComponentImplementation::parameterPortBegin ( )
ComponentImplementation::ParameterPortContainer::const_iterator visr::impl::ComponentImplementation::parameterPortEnd ( ) const
ComponentImplementation::ParameterPortContainer::iterator visr::impl::ComponentImplementation::parameterPortEnd ( )
ParameterPortContainer const& visr::impl::ComponentImplementation::parameterPorts ( ) const
inline
ParameterPortContainer& visr::impl::ComponentImplementation::parameterPorts ( )
inline
CompositeComponentImplementation* visr::impl::ComponentImplementation::parent ( )
inline

Return a pointer to the implementation object of the parent component, or nullptr if this is a top-level component.

CompositeComponentImplementation const* visr::impl::ComponentImplementation::parent ( ) const
inline

Return a const pointer to the implementation object of the parent component, or nullptr if this is a top-level component.

std::size_t visr::impl::ComponentImplementation::period ( ) const

Return the period of the containing signal processing graph, i.e., the number of samples processed in each invocation of the process function of the derived audio components. This methods can be called at any point of the lifetime of the derived component, i.e., for instance in the constructor.

Todo:
: Check whether this should be made inline again (adding the dependency to the runtime container (aka SignalFlow).
template<class PortType >
PortContainer<PortType>::iterator visr::impl::ComponentImplementation::portBegin ( )
inline
template<class PortType >
PortContainer<PortType>::const_iterator visr::impl::ComponentImplementation::portBegin ( ) const
inline
template<class PortType >
PortContainer<PortType>::iterator visr::impl::ComponentImplementation::portEnd ( )
inline
template<class PortType >
PortContainer<PortType>::const_iterator visr::impl::ComponentImplementation::portEnd ( ) const
inline
template<class PortType >
PortContainer<PortType> const& visr::impl::ComponentImplementation::ports ( ) const

Uniform access to audio and parameter ports using templates Return the port container for the specified port type, const version . This template method is explicitly instantiated for the two possible port types AudioPort and ParameterPortBase

Template Parameters
PortType
Returns
a const reference to the port container.
template<class PortType >
PortContainer<PortType>& visr::impl::ComponentImplementation::ports ( )

Return the port container for the specified port type, non-const version. This template method is explicitly instantiated for the two possible port types AudioPort and ParameterPortBase

Template Parameters
PortType
Returns
a modifiable reference to the port container.
template<>
ComponentImplementation::PortContainer<AudioPortBaseImplementation> const& visr::impl::ComponentImplementation::ports ( ) const
template<>
ComponentImplementation::PortContainer<ParameterPortBaseImplementation> const& visr::impl::ComponentImplementation::ports ( ) const
template<>
ComponentImplementation::PortContainer<AudioPortBaseImplementation>& visr::impl::ComponentImplementation::ports ( )
template<>
ComponentImplementation::PortContainer<ParameterPortBaseImplementation>& visr::impl::ComponentImplementation::ports ( )
void visr::impl::ComponentImplementation::registerParameterPort ( ParameterPortBaseImplementation port)

Register a parameter port in the component. Generally performed in the port's constructor.

Todo:
consider making this a template method to share the implementation between audio and parameter ports.
SamplingFrequencyType visr::impl::ComponentImplementation::samplingFrequency ( ) const

Return the sampling frequency of the containing signal flow.

void visr::impl::ComponentImplementation::status ( StatusMessage::Kind  statusId,
char const *  message 
)

Report a status message, either informational or an error condition.

bool visr::impl::ComponentImplementation::unregisterParameterPort ( ParameterPortBaseImplementation port)

Unregister a parameter port in the component. Generally performed in the port's destructor.

Todo:
consider making this a template method to share the implementation between audio and parameter ports.

Friends And Related Function Documentation

friend class AudioPortBaseImplementation
friend
friend class CompositeComponentImplementation
friend
template ComponentImplementation::PortContainer< AudioPortBaseImplementation >::const_iterator findPortEntry< AudioPortBaseImplementation > ( char const *  portName) const
related

Explicit instantiation of template findPortEntry for port type AudioPortBaseImplementation, const variant..

template ComponentImplementation::PortContainer< ParameterPortBaseImplementation >::const_iterator findPortEntry< ParameterPortBaseImplementation > ( char const *  portName) const
related

Explicit instantiation of template findPortEntry for port type ParameterPortBaseImplementation, const variant..

template ComponentImplementation::PortContainer< AudioPortBaseImplementation >::iterator findPortEntry< AudioPortBaseImplementation > ( const char *  portName)
related

Explicit instantiation of template findPortEntry for port type AudioPortBaseImplementation, non-const variant.

template ComponentImplementation::PortContainer< ParameterPortBaseImplementation >::iterator findPortEntry< ParameterPortBaseImplementation > ( char const *  portName)
related

Explicit instantiation of template findPortEntry for port type ParameterPortBaseImplementation, non-const variant..

friend class ParameterPortBaseImplementation
friend

Member Data Documentation

const std::string visr::impl::ComponentImplementation::cNameSeparator = ":"
static

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