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
pathSubject.h
Go to the documentation of this file.
1#line 1 "S:/jenkins/workspace/ECP/ufe/ufe-full-python3.11-windows/ufe/include/pathSubject.h"
2#ifndef _ufePathSubject
3#define _ufePathSubject
4// ===========================================================================
5// Copyright 2018 Autodesk, Inc. All rights reserved.
6//
7// Use of this software is subject to the terms of the Autodesk license
8// agreement provided at the time of installation or download, or which
9// otherwise accompanies this software in either electronic or hard copy form.
10// ===========================================================================
11
12#include "common/ufeExport.h"
13
14#include "subject.h"
15#include "sceneItem.h"
16#include "path.h"
17
18#include <memory>
19#include <vector>
20#include <functional>
21
23
24class Notification;
25
27
38{
39public:
40 typedef std::shared_ptr<PathSubject> Ptr;
41
42 // Prevent the re-definition of the private helper methods from hiding
43 // the public methods on Subject that we want to remain callable.
44 using Subject::addObserver;
45 using Subject::removeObserver;
46
53 using AddObserverFcn = std::function<bool(const SceneItem::Ptr& item, const Observer::Ptr& obs)>;
54
61 using RemoveObserverFcn = std::function<bool(const Path& Path, const Observer::Ptr& obs)>;
62
64 ~PathSubject() override;
65
72 PathSubject(const Path& path, AddObserverFcn addObserverFcn, RemoveObserverFcn removeObserverFcn);
73
74private:
75 // Use for scene changes
76 void addObserver(const Path& path);
77 void removeObserver(const Path& path);
78 void addObservers(const Path& path, const Path& endAncestor);
79 void removeObservers(const Path& path, const Path& endAncestor);
80
86 template<bool ADD_OBSERVER>
88
96 template<bool ADD_OBSERVER>
97 void addRemoveObserversHelper(Path path, const Path& endAncestor);
98
99 void reparent(const Path& oldPath, const Path& newPath);
100 void rename(const Path& oldPath, const Path& newPath);
101 void objectDelete(const Path& path);
102
103 class SceneChangedObserver;
104
111};
112
113}
114
115#endif /* _ufePathSubject */
std::shared_ptr< Observer > Ptr
Definition: observer.h:36
Identify an object or 3D path in the scene.
Definition: path.h:38
Helper to make a Path observable.
Definition: pathSubject.h:38
void removeObserver(const Path &path)
void addObservers(const Path &path, const Path &endAncestor)
void rename(const Path &oldPath, const Path &newPath)
const AddObserverFcn _addObserverFcn
Definition: pathSubject.h:106
const RemoveObserverFcn _removeObserverFcn
Definition: pathSubject.h:107
std::function< bool(const Path &Path, const Observer::Ptr &obs)> RemoveObserverFcn
Callable function to remove an observer from a Path.
Definition: pathSubject.h:61
std::shared_ptr< PathSubject > Ptr
Definition: pathSubject.h:40
void objectDelete(const Path &path)
~PathSubject() override
Destructor.
std::function< bool(const SceneItem::Ptr &item, const Observer::Ptr &obs)> AddObserverFcn
Callable function to add an observer to a SceneItem.
Definition: pathSubject.h:53
void addObserver(const Path &path)
const Observer::Ptr _sceneChangedObserver
Definition: pathSubject.h:109
void reparent(const Path &oldPath, const Path &newPath)
void addRemoveObserverHelper(const Path &path)
void addRemoveObserversHelper(Path path, const Path &endAncestor)
PathSubject(const Path &path, AddObserverFcn addObserverFcn, RemoveObserverFcn removeObserverFcn)
void removeObservers(const Path &path, const Path &endAncestor)
const Observer::Ptr _forwardingObserver
Definition: pathSubject.h:108
std::shared_ptr< SceneItem > Ptr
Definition: sceneItem.h:44
Observer pattern Subject class.
Definition: subject.h:41
Path path(const std::string &pathString)
#define UFE_NS_DEF
Definition: ufe.h:35
Definition of macros for symbol visibility.
#define UFE_SDK_DECL
Definition: ufeExport.h:36