![]() |
NDEVR
API Documentation
|
Creates logic that mirrors two resources. More...
Public Member Functions | |
| ResourceMirror (Resource< t_type > &a, Resource< t_type > &b) | |
| Constructs a ResourceMirror that synchronizes two resources bidirectionally. | |
| virtual | ~ResourceMirror () |
| Destructor. | |
| virtual void | addInfoParent (const ResourceBase *info) override |
| Registers a parent resource that this listener depends on. | |
| virtual void | onValueChanged () override |
| Called when either mirrored resource changes. | |
| virtual void | removeInfoParent (const ResourceBase *info) override |
| Removes a parent resource and disconnects this listener. | |
| Public Member Functions inherited from ResourceListener | |
| ResourceListener () | |
| Constructs a default ResourceListener. | |
| virtual | ~ResourceListener () |
| Virtual destructor. | |
| void | changeValue () |
| Triggers the value changed callback for this listener. | |
| void | disable (bool disable) |
| Enables or disables this listener. | |
| void | disconnectListener () |
| Disconnects this listener from all parent resources it is subscribed to. | |
| uint04 | getInfoParentSize () const |
| Returns the number of parent resources this listener is subscribed to. | |
Public Attributes | |
| Resource< t_type > & | a |
| The first mirrored resource. | |
| Resource< t_type > & | b |
| The second mirrored resource. | |
| t_type | value |
| The last known synchronized value, used to detect which resource changed. | |
Creates logic that mirrors two resources.
Meaning changing either resource will modify the other resource.
Definition at line 41 of file ResourceMirror.h.
|
inline |
Constructs a ResourceMirror that synchronizes two resources bidirectionally.
| [in] | a | The first resource to mirror. |
| [in] | b | The second resource to mirror. Its value is initially synced from a. |
Definition at line 49 of file ResourceMirror.h.
References ResourceListener::ResourceListener(), a, and b.
|
inlineoverridevirtual |
Registers a parent resource that this listener depends on.
| [in] | info | The parent resource to add. |
Reimplemented from ResourceListener.
Definition at line 67 of file ResourceMirror.h.
References ResourceListener::addInfoParent().
|
inlineoverridevirtual |
Called when either mirrored resource changes.
Propagates the new value to the other resource to keep them in sync.
Implements ResourceListener.
Definition at line 84 of file ResourceMirror.h.
|
inlineoverridevirtual |
Removes a parent resource and disconnects this listener.
| [in] | info | The parent resource to remove. |
Reimplemented from ResourceListener.
Definition at line 75 of file ResourceMirror.h.
References ResourceListener::disconnectListener(), and ResourceListener::removeInfoParent().