ufe 5.5
Universal Front End is a DCC-agnostic component that will allow a DCC to browse and edit data in multiple data models
|
Helper to make a Path observable. More...
#include <pathSubject.h>
Public Types | |
typedef std::shared_ptr< PathSubject > | Ptr |
using | AddObserverFcn = std::function< bool(const SceneItem::Ptr &item, const Observer::Ptr &obs)> |
Callable function to add an observer to a SceneItem. More... | |
using | RemoveObserverFcn = std::function< bool(const Path &Path, const Observer::Ptr &obs)> |
Callable function to remove an observer from a Path. More... | |
Public Member Functions | |
~PathSubject () override | |
Destructor. More... | |
PathSubject (const Path &path, AddObserverFcn addObserverFcn, RemoveObserverFcn removeObserverFcn) | |
bool | addObserver (const Observer::Ptr &obs) |
bool | removeObserver (const Observer::Ptr &obs) |
Public Member Functions inherited from Ufe::Subject | |
Subject () | |
Constructor. More... | |
Subject (const Subject &) | |
Copy constructor. Observers are not copied. More... | |
Subject (Subject &&) | |
Move constructor. Observers are not moved. More... | |
virtual | ~Subject () |
Destructor. More... | |
Subject & | operator= (const Subject &) |
Assignment operator. Does nothing, as observers are not copied. More... | |
Subject & | operator= (Subject &&) |
Move assignment operator. Does nothing, as observers are not moved. More... | |
bool | addObserver (const Observer::Ptr &obs) |
bool | removeObserver (const Observer::Ptr &obs) |
bool | hasObserver (const Observer::Ptr &obs) const |
std::size_t | nbObservers () const |
virtual void | notify (const Notification ¬ification) |
virtual bool | inCompositeNotification () const |
Private Member Functions | |
void | addObserver (const Path &path) |
void | removeObserver (const Path &path) |
void | addObservers (const Path &path, const Path &endAncestor) |
void | removeObservers (const Path &path, const Path &endAncestor) |
template<bool ADD_OBSERVER> | |
void | addRemoveObserverHelper (const Path &path) |
template<bool ADD_OBSERVER> | |
void | addRemoveObserversHelper (Path path, const Path &endAncestor) |
void | reparent (const Path &oldPath, const Path &newPath) |
void | rename (const Path &oldPath, const Path &newPath) |
void | objectDelete (const Path &path) |
Private Attributes | |
Path | _path |
const AddObserverFcn | _addObserverFcn |
const RemoveObserverFcn | _removeObserverFcn |
const Observer::Ptr | _forwardingObserver |
const Observer::Ptr | _sceneChangedObserver |
bool | _attached |
Additional Inherited Members | |
Protected Member Functions inherited from Ufe::Subject | |
virtual void | beginNotificationGuard () |
Notification guard interface. Implementation in this class is a no-op. More... | |
virtual void | endNotificationGuard () |
Helper to make a Path observable.
PathSubject observes all SceneItems in its path and forwards all notifications to the observers of PathSubject.
In Ufe a SceneItem can have multiple subjects to observe. PathSubject observes the SceneItem subjects which are registered through the AddSubject function.
As the observed path changes (through reparent operations) the set of observed SceneItem subjects is automatically updated to reflect the new path.
Definition at line 37 of file pathSubject.h.
using Ufe::PathSubject::AddObserverFcn = std::function<bool(const SceneItem::Ptr& item, const Observer::Ptr& obs)> |
Callable function to add an observer to a SceneItem.
item | The SceneItem to observe |
obs | The observer to add |
Definition at line 53 of file pathSubject.h.
typedef std::shared_ptr<PathSubject> Ufe::PathSubject::Ptr |
Definition at line 40 of file pathSubject.h.
using Ufe::PathSubject::RemoveObserverFcn = std::function<bool(const Path& Path, const Observer::Ptr& obs)> |
Callable function to remove an observer from a Path.
path | The Path to remove observation on |
obs | The observer to remove |
Definition at line 61 of file pathSubject.h.
|
override |
Destructor.
Ufe::PathSubject::PathSubject | ( | const Path & | path, |
AddObserverFcn | addObserverFcn, | ||
RemoveObserverFcn | removeObserverFcn | ||
) |
Constructor
path | Path to make observable |
addObserverFcn | Callable function to add an observer to a scene item |
removeObserverFcn | Callable function to remove an observer from a path |
bool Ufe::Subject::addObserver | ( | const Observer::Ptr & | obs | ) |
|
private |
|
private |
|
private |
Add or Remove an observers from Path and each ancestor of path to endAncestor, not including endAncestor itself.
|
private |
bool Ufe::Subject::removeObserver | ( | const Observer::Ptr & | obs | ) |
|
private |
|
private |
Definition at line 106 of file pathSubject.h.
|
private |
Definition at line 110 of file pathSubject.h.
|
private |
Definition at line 108 of file pathSubject.h.
|
private |
Definition at line 105 of file pathSubject.h.
|
private |
Definition at line 107 of file pathSubject.h.
|
private |
Definition at line 109 of file pathSubject.h.