OpenWalnut
1.4.0
|
This class helps especially container module programmers to easily synchronize the value of one flag with several other flag. More...
#include <WFlagForwarder.h>
Public Member Functions | |
WFlagForwarder (boost::shared_ptr< WFlag< T > > source) | |
Default constructor. | |
virtual | ~WFlagForwarder () |
Destructor. | |
void | forward (boost::shared_ptr< WFlag< T > > to) |
Forward the source property to the specified one. | |
Protected Member Functions | |
void | sourceChanged () |
This is a callback and gets called whenever the source property has changed. | |
Protected Attributes | |
boost::shared_ptr< WFlag< T > > | m_source |
The source property to which all other properties are synced to. | |
boost::signals2::connection | m_sourceConnection |
The signal fired by m_source upon value change. | |
boost::signals2::signal< void(T) > | signal_forward |
Signal forwarding the new value. | |
Private Member Functions | |
WFlagForwarder (const WFlagForwarder &rhs) | |
Disallow copy construction. | |
WFlagForwarder & | operator= (const WFlagForwarder &rhs) |
Disallow copy assignment. |
This class helps especially container module programmers to easily synchronize the value of one flag with several other flag.
Assume the following scenario: you have a container module with two isosurface modules whose isovalue-properties need to be in sync with the isovalue-property your container module provides to the outside world. Here, WFlagForwaderd comes into play. Add the first isosurface's isovalue-property to the container modules m_properties list and forward it to the other isovalue-property of the second isosurface module. Now they are in sync. Be aware, that this is not a property itself!
T | the encapsulated type inside the flag. I.e. for WFlag< int32_t > use T=int32_t |
Definition at line 53 of file WFlagForwarder.h.
WFlagForwarder< T >::WFlagForwarder | ( | boost::shared_ptr< WFlag< T > > | source | ) | [explicit] |
Default constructor.
source | the property to be used as reference. All other properties will be synced with this one. |
Definition at line 115 of file WFlagForwarder.h.
References WFlagForwarder< T >::m_sourceConnection, and WFlagForwarder< T >::sourceChanged().
WFlagForwarder< T >::~WFlagForwarder | ( | ) | [virtual] |
Destructor.
Definition at line 123 of file WFlagForwarder.h.
WFlagForwarder< T >::WFlagForwarder | ( | const WFlagForwarder< T > & | rhs | ) | [private] |
Disallow copy construction.
rhs | the other forwarder. |
void WFlagForwarder< T >::forward | ( | boost::shared_ptr< WFlag< T > > | to | ) |
Forward the source property to the specified one.
This ensures that the flag in "to" always has the value of the source flag. There is no remove method.
to | the property to sync with source. |
Definition at line 131 of file WFlagForwarder.h.
References WFlag< T >::get().
Referenced by WFlagForwarderTest::testPropagation().
WFlagForwarder& WFlagForwarder< T >::operator= | ( | const WFlagForwarder< T > & | rhs | ) | [private] |
Disallow copy assignment.
rhs | the other forwarder. |
void WFlagForwarder< T >::sourceChanged | ( | ) | [protected] |
This is a callback and gets called whenever the source property has changed.
Definition at line 140 of file WFlagForwarder.h.
Referenced by WFlagForwarder< T >::WFlagForwarder().
boost::shared_ptr< WFlag< T > > WFlagForwarder< T >::m_source [protected] |
The source property to which all other properties are synced to.
Definition at line 80 of file WFlagForwarder.h.
boost::signals2::connection WFlagForwarder< T >::m_sourceConnection [protected] |
The signal fired by m_source upon value change.
Definition at line 85 of file WFlagForwarder.h.
Referenced by WFlagForwarder< T >::WFlagForwarder().
boost::signals2::signal< void( T ) > WFlagForwarder< T >::signal_forward [protected] |
Signal forwarding the new value.
Definition at line 90 of file WFlagForwarder.h.