OpenWalnut
1.5.0dev
|
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 (std::shared_ptr< WFlag< T > > source) | |
Default constructor. More... | |
virtual | ~WFlagForwarder () |
Destructor. More... | |
void | forward (std::shared_ptr< WFlag< T > > to) |
Forward the source property to the specified one. More... | |
Protected Member Functions | |
void | sourceChanged () |
This is a callback and gets called whenever the source property has changed. More... | |
Protected Attributes | |
std::shared_ptr< WFlag< T > > | m_source |
The source property to which all other properties are synced to. More... | |
boost::signals2::connection | m_sourceConnection |
The signal fired by m_source upon value change. More... | |
boost::signals2::signal< void(T) > | signal_forward |
Signal forwarding the new value. More... | |
Private Member Functions | |
WFlagForwarder (const WFlagForwarder &rhs) | |
Disallow copy construction. More... | |
WFlagForwarder & | operator= (const WFlagForwarder &rhs) |
Disallow copy assignment. More... | |
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 54 of file WFlagForwarder.h.
|
explicit |
Default constructor.
source | the property to be used as reference. All other properties will be synced with this one. |
Definition at line 116 of file WFlagForwarder.h.
References WFlagForwarder< T >::m_sourceConnection, and WFlagForwarder< T >::sourceChanged().
|
virtual |
Destructor.
Definition at line 124 of file WFlagForwarder.h.
|
private |
Disallow copy construction.
rhs | the other forwarder. |
void WFlagForwarder< T >::forward | ( | std::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 132 of file WFlagForwarder.h.
References WFlag< T >::get().
Referenced by WFlagForwarderTest::testPropagation().
|
private |
Disallow copy assignment.
rhs | the other forwarder. |
|
protected |
This is a callback and gets called whenever the source property has changed.
Definition at line 141 of file WFlagForwarder.h.
Referenced by WFlagForwarder< T >::WFlagForwarder().
|
protected |
The source property to which all other properties are synced to.
Definition at line 81 of file WFlagForwarder.h.
|
protected |
The signal fired by m_source upon value change.
Definition at line 86 of file WFlagForwarder.h.
Referenced by WFlagForwarder< T >::WFlagForwarder().
|
protected |
Signal forwarding the new value.
Definition at line 91 of file WFlagForwarder.h.