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 118 of file WFlagForwarder.h.
References WFlagForwarder< T >::m_sourceConnection, and WFlagForwarder< T >::sourceChanged().
| WFlagForwarder< T >::~WFlagForwarder | ( | ) | [virtual] |
Destructor.
Definition at line 126 of file WFlagForwarder.h.
References WFlagForwarder< T >::m_sourceConnection, and WFlagForwarder< T >::signal_forward.
| 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 134 of file WFlagForwarder.h.
References WFlagForwarder< T >::m_source, and WFlagForwarder< T >::signal_forward.
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 143 of file WFlagForwarder.h.
References WFlagForwarder< T >::m_source, and WFlagForwarder< T >::signal_forward.
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 82 of file WFlagForwarder.h.
Referenced by WFlagForwarder< T >::forward(), and WFlagForwarder< T >::sourceChanged().
boost::signals2::connection WFlagForwarder< T >::m_sourceConnection [protected] |
The signal fired by m_source upon value change.
Definition at line 87 of file WFlagForwarder.h.
Referenced by WFlagForwarder< T >::WFlagForwarder(), and WFlagForwarder< T >::~WFlagForwarder().
boost::signals2::signal< void( T ) > WFlagForwarder< T >::signal_forward [protected] |
Signal forwarding the new value.
Definition at line 92 of file WFlagForwarder.h.
Referenced by WFlagForwarder< T >::forward(), WFlagForwarder< T >::sourceChanged(), and WFlagForwarder< T >::~WFlagForwarder().
1.7.1