VISR  0.12.0
Versatile Interactive Scene Renderer
port_base_implementation.hpp
Go to the documentation of this file.
1 /* Copyright Institute of Sound and Vibration Research - All rights reserved */
2 
3 #ifndef VISR_IMPL_PORT_BASE_IMPLEMENTATIONHPP_INCLUDED
4 #define VISR_IMPL_PORT_BASE_IMPLEMENTATIONHPP_INCLUDED
5 
6 
7 #include "../port_base.hpp"
8 #include "../export_symbols.hpp"
9 
10 #include <string>
11 
12 namespace visr
13 {
14 namespace impl
15 {
16 
17 // Forward declaration(s)
18 class ComponentImplementation;
19 
21 {
22 public:
23 
24  explicit VISR_CORE_LIBRARY_SYMBOL PortBaseImplementation( char const * name, ComponentImplementation * container, visr::PortBase::Direction direction );
25 
29  PortBaseImplementation() = delete;
30 
34  PortBaseImplementation( PortBaseImplementation const & ) = delete;
35 
39  PortBaseImplementation( PortBaseImplementation && ) = delete;
40 
41  PortBaseImplementation & operator=( PortBaseImplementation const & ) = delete;
42 
43  PortBaseImplementation & operator=( PortBaseImplementation && ) = delete;
44 
50  VISR_CORE_LIBRARY_SYMBOL ~PortBaseImplementation();
51 
52  VISR_CORE_LIBRARY_SYMBOL char const * name() const { return mName.c_str(); }
53 
54  VISR_CORE_LIBRARY_SYMBOL bool hasParent() const noexcept;
55 
56  VISR_CORE_LIBRARY_SYMBOL ComponentImplementation const & parent() const;
57 
62  VISR_CORE_LIBRARY_SYMBOL ComponentImplementation & parent();
63 
64  /*
65  * Set a new parent to this port.
66  * @param newParent the new parent component, use nullptr to unset the parent.
67  */
68  VISR_CORE_LIBRARY_SYMBOL void setParent( ComponentImplementation * newParent ) noexcept;
69 
73  VISR_CORE_LIBRARY_SYMBOL void removeParent() noexcept;
74 
75  VISR_CORE_LIBRARY_SYMBOL visr::PortBase::Direction direction() const { return mDirection; }
76 
77 private:
78  std::string const mName;
79 
80  ComponentImplementation * mParentComponent;
81 
82  visr::PortBase::Direction const mDirection;
83 };
84 
85 } // namespace impl
86 } // namespace visr
87 
88 #endif // #ifndef VISR_IMPL_PORT_BASE_IMPLEMENTATIONHPP_INCLUDED
bool hasParent() const noexcept
Definition: port_base_implementation.cpp:24
~PortBaseImplementation()
Definition: port_base_implementation.cpp:20
Direction
Definition: port_base.hpp:22
Definition: component_implementation.hpp:34
void setParent(ComponentImplementation *newParent) noexcept
Definition: port_base_implementation.cpp:47
ComponentImplementation const & parent() const
Definition: port_base_implementation.cpp:29
Definition: port_base_implementation.hpp:20
Definition: options.cpp:10
char const * name() const
Definition: port_base_implementation.hpp:52
PortBaseImplementation & operator=(PortBaseImplementation const &)=delete
void removeParent() noexcept
Definition: port_base_implementation.cpp:52
visr::PortBase::Direction direction() const
Definition: port_base_implementation.hpp:75