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
path.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/path.h"
2#ifndef UFE_PATH_H
3#define UFE_PATH_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 "pathSegment.h"
14
15#include <optional>
16#include <vector>
17
19
20class PathComponent;
21
23
40{
41public:
42
43 typedef std::vector<PathSegment> Segments;
45
47 Path() = default;
48
54 Path(const Segments& segments);
55
61 Path(Segments&& segments) noexcept;
62
67 Path(const PathSegment& segment);
68
70 Path(PathSegment&& segment) noexcept;
71
73 Path(const Path&) = default;
74
78
80 Path& operator=(const Path&) = default;
81
83 Path(Path&&) noexcept;
84
86 Path& operator=(Path&& rhs) noexcept;
87
89 Components::size_type size() const;
90
93 bool empty() const;
94
97 bool operator==(const Path& rhs) const;
98 bool operator!=(const Path& rhs) const;
100
106 Path operator+(const PathSegment& rhs) const;
107 Path operator+(const PathComponent& rhs) const;
108 Path operator+(const std::string& rhs) const;
110
113 Path pop() const;
114
117 Path popSegment() const;
118
121 Path popHead() const;
122
126 Path head(int nbComponents) const;
127
130 PathComponent back() const;
131
135 Path sibling(const PathComponent& newTail) const;
136
140 bool startsWith(const Path& prefix) const;
141
148 Path replaceComponent(int index, const PathComponent& replacement) const;
149
160 Path reparent(const Path& originalPrefix, const Path& newPrefix) const;
161
164 Components::const_iterator cbegin() const;
165 Components::const_iterator begin() const;
166 Components::const_iterator cend() const;
167 Components::const_iterator end() const;
168 Components::iterator begin();
169 Components::iterator end();
171
173 Rtid runTimeId() const;
174
176 const Segments& getSegments() const;
177
179 Segments::size_type nbSegments() const;
180
182 std::string string() const;
183
185 std::size_t hash() const;
186
187private:
188
189 Segments fSegments;
190 // Provide support for component-based access and iteration. This
191 // doubles up space requirements, but components are not expensive
192 // (size of a shared pointer, typically two plain pointers).
193 Components fComponents;
194
195 // A Path is immutable, so its hash value can be cached once computed.
196 mutable std::optional<std::size_t> fHashValue;
197};
198
199}
200
201// Allow for use of Path with std::unordered_map.
202namespace std {
203template <> struct hash<UFE_VERSIONED_NS::Path> {
204 std::size_t operator()(const UFE_VERSIONED_NS::Path& path) const {return path.hash();}
205};
206}
207
208#endif /* UFE_PATH_H */
Constant string representation with fixed space and O(1) comparison.
Definition: pathComponent.h:35
Identify an object or 3D path in the scene.
Definition: path.h:40
Path(Segments &&segments) noexcept
std::vector< PathSegment > Segments
Definition: path.h:43
std::size_t hash() const
Path & operator=(const Path &)=default
Default assignment operator.
Path(const Path &)=default
Default copy constructor.
Path(Path &&) noexcept
Move construction. Right hand side becomes empty.
PathSegment::Components Components
Definition: path.h:44
Path()=default
Default constructor. Creates an empty path.
Path(const Segments &segments)
Path(const PathSegment &segment)
Path(PathSegment &&segment) noexcept
Move constructor.
A segment of a path within a single runtime.
Definition: pathSegment.h:37
std::vector< PathComponent > Components
Definition: pathSegment.h:40
Path path(const std::string &pathString)
uint32_t Rtid
Definition: rtid.h:27
Definition: path.h:202
std::size_t operator()(const Ufe_v7 ::Path &path) const
Definition: path.h:204
#define UFE_VERSIONED_NS
Definition: ufe.h:23
#define UFE_NS_DEF
Definition: ufe.h:36
#define UFE_SDK_DECL
Definition: ufeExport.h:35