ufe 7.0
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 "D:/Jenkins/workspace/EMS/ECG/ufe/full/ufe-full-python3.13-windows/ufe/include/pathSubject.h"
2#ifndef UFE_PATHSUBJECT_H
3#define UFE_PATHSUBJECT_H
4
5// ===========================================================================
6// Copyright 2025 Autodesk, Inc. All rights reserved.
7//
8// The use of this software is subject to the Autodesk Terms of Use or other
9// license agreement provided at the time of installation or download, or
10// which otherwise accompanies this software.
11// ===========================================================================
12
13#include "common/ufeExport.h"
14
15#include "subject.h"
16#include "sceneItem.h"
17#include "path.h"
18
19#include <memory>
20#include <vector>
21#include <functional>
22
24
25class Notification;
26
28
39{
40public:
41 typedef std::shared_ptr<PathSubject> Ptr;
42
43 // Prevent the re-definition of the private helper methods from hiding
44 // the public methods on Subject that we want to remain callable.
45 using Subject::addObserver;
46 using Subject::removeObserver;
47
54 using AddObserverFcn = std::function<bool(const SceneItem::Ptr& item, const Observer::Ptr& obs)>;
55
62 using RemoveObserverFcn = std::function<bool(const Path& Path, const Observer::Ptr& obs)>;
63
65 ~PathSubject() override;
66
73 PathSubject(const Path& path, AddObserverFcn addObserverFcn, RemoveObserverFcn removeObserverFcn);
74
75private:
76 // Use for scene changes
77 void addObserver(const Path& path);
78 void removeObserver(const Path& path);
79 void addObservers(const Path& path, const Path& endAncestor);
80 void removeObservers(const Path& path, const Path& endAncestor);
81
87 template<bool ADD_OBSERVER>
89
97 template<bool ADD_OBSERVER>
98 void addRemoveObserversHelper(Path path, const Path& endAncestor);
99
100 void reparent(const Path& oldPath, const Path& newPath);
101 void rename(const Path& oldPath, const Path& newPath);
102 void objectDelete(const Path& path);
103
104 class SceneChangedObserver;
105
112};
113
114}
115
116#endif /* UFE_PATHSUBJECT_H */
std::shared_ptr< Observer > Ptr
Definition: observer.h:37
Identify an object or 3D path in the scene.
Definition: path.h:40
Helper to make a Path observable.
Definition: pathSubject.h:39
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:107
const RemoveObserverFcn _removeObserverFcn
Definition: pathSubject.h:108
std::function< bool(const Path &Path, const Observer::Ptr &obs)> RemoveObserverFcn
Callable function to remove an observer from a Path.
Definition: pathSubject.h:62
std::shared_ptr< PathSubject > Ptr
Definition: pathSubject.h:41
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:54
void addObserver(const Path &path)
const Observer::Ptr _sceneChangedObserver
Definition: pathSubject.h:110
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:109
std::shared_ptr< SceneItem > Ptr
Definition: sceneItem.h:45
Observer pattern Subject class.
Definition: subject.h:42
Path path(const std::string &pathString)
#define UFE_NS_DEF
Definition: ufe.h:36
Definition of macros for symbol visibility.
#define UFE_SDK_DECL
Definition: ufeExport.h:35