VISR  0.11.1
Versatile Interactive Scene Renderer
port_utilities.hpp
Go to the documentation of this file.
1 /* Copyright Institute of Sound and Vibration Research - All rights reserved */
2 
3 #ifndef VISR_LIBRRL_PORT_UTILITIES_HPP_INCLUDED
4 #define VISR_LIBRRL_PORT_UTILITIES_HPP_INCLUDED
5 
6 #include <iosfwd>
7 #include <set>
8 #include <string>
9 
10 namespace visr
11 {
12 // Forward declarations
13 class AudioPortBase;
14 class ParameterPortBase;
15 
16 namespace impl
17 {
18 class ComponentImplementation;
19 class ParameterPortBaseImplementation;
20 class PortBaseImplementation;
21 }
22 
23 namespace rrl
24 {
25 
29 std::string qualifiedName( impl::PortBaseImplementation const & port );
30 
35 std::string fullyQualifiedName( impl::PortBaseImplementation const & port );
36 
41 bool isPlaceholderPort( impl::PortBaseImplementation const * const port );
42 
46 bool isToplevelPort( impl::PortBaseImplementation const * const port );
47 
48 bool checkParameterPortCompatibility( impl::ParameterPortBaseImplementation const & sendPort, impl::ParameterPortBaseImplementation const & receivePort,
49  std::ostream & messages );
50 
55 template<class PortType>
57 {
58 public:
59  using PortTable = std::set<PortType *>;
60 
66  explicit PortLookup( impl::ComponentImplementation const & comp, bool recurse = true );
67 
71  PortTable const & placeholderReceivePorts() const { return mPlaceholderReceivePorts; }
72 
76  PortTable const & placeholderSendPorts() const { return mPlaceholderSendPorts; }
77 
81  PortTable const & concreteSendPorts() const { return mConcreteSendPorts; }
82 
86  PortTable const & concreteReceivePorts() const { return mConcreteReceivePorts; }
87 
91  PortTable const & externalCapturePorts() const { return mExternalCapturePorts; }
92 
96  PortTable const & externalPlaybackPorts() const { return mExternalPlaybackPorts; }
97 
101  PortTable const & allNonPlaceholderSendPorts() const { return mAllNonPlaceholderSendPorts; }
102 
106  PortTable const & allNonPlaceholderReceivePorts() const { return mAllNonPlaceholderReceivePorts; }
107 
108 private:
109 
116  void traverseComponent( impl::ComponentImplementation const & comp, bool hierarchical, bool topLevel );
117 
118  PortTable mPlaceholderReceivePorts;
119  PortTable mPlaceholderSendPorts;
120  PortTable mConcreteSendPorts;
121  PortTable mConcreteReceivePorts;
122  PortTable mExternalCapturePorts;
123  PortTable mExternalPlaybackPorts;
124  PortTable mAllNonPlaceholderSendPorts;
125  PortTable mAllNonPlaceholderReceivePorts;
126 };
127 
128 template<typename PortType>
129 std::ostream & operator<<( std::ostream & str, typename PortLookup<PortType>::PortTable const & table );
130 
131 template<typename PortType>
132 std::ostream & operator<<( std::ostream & str, PortLookup<PortType> const & lookup );
133 
134 } // namespace rrl
135 } // namespace visr
136 
137 #endif // #ifndef VISR_LIBRRL_PORT_UTILITIES_HPP_INCLUDED
bool checkParameterPortCompatibility(impl::ParameterPortBaseImplementation const &sendPort, impl::ParameterPortBaseImplementation const &receivePort, std::ostream &messages)
Definition: port_utilities.cpp:50
PortTable const & concreteReceivePorts() const
Definition: port_utilities.hpp:86
std::string fullyQualifiedName(impl::PortBaseImplementation const &port)
Definition: port_utilities.cpp:45
bool isPlaceholderPort(impl::PortBaseImplementation const *const port)
Definition: port_utilities.cpp:20
Definition: component_implementation.hpp:34
PortLookup(impl::ComponentImplementation const &comp, bool recurse=true)
Definition: port_utilities.cpp:99
std::string qualifiedName(impl::PortBaseImplementation const &port)
Definition: port_utilities.cpp:40
PortTable const & placeholderReceivePorts() const
Definition: port_utilities.hpp:71
PortTable const & externalPlaybackPorts() const
Definition: port_utilities.hpp:96
PortTable const & allNonPlaceholderSendPorts() const
Definition: port_utilities.hpp:101
Definition: port_utilities.hpp:56
Definition: options.cpp:10
PortTable const & externalCapturePorts() const
Definition: port_utilities.hpp:91
PortTable const & placeholderSendPorts() const
Definition: port_utilities.hpp:76
bool isToplevelPort(impl::PortBaseImplementation const *const port)
Definition: port_utilities.cpp:35
std::set< PortType * > PortTable
Definition: port_utilities.hpp:59
PortTable const & concreteSendPorts() const
Definition: port_utilities.hpp:81
PortTable const & allNonPlaceholderReceivePorts() const
Definition: port_utilities.hpp:106