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
path.h
Go to the documentation of this file.
1#line 1 "S:/jenkins/workspace/ECP/ufe/ufe-full-python3.11-windows/ufe/include/path.h"
2#ifndef _ufePath
3#define _ufePath
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 "pathSegment.h"
13
14#include <vector>
15
17
18class PathComponent;
19
21
38{
39public:
40
41 typedef std::vector<PathSegment> Segments;
43
45 Path() = default;
46
52 Path(const Segments& segments);
53
59 Path(Segments&& segments) noexcept;
60
65 Path(const PathSegment& segment);
66
68 Path(PathSegment&& segment) noexcept;
69
71 Path(const Path&) = default;
72
76
78 Path& operator=(const Path&) = default;
79
81 Path(Path&&) noexcept;
82
84 Path& operator=(Path&& rhs) noexcept;
85
87 Components::size_type size() const;
88
91 bool empty() const;
92
94
95 bool operator==(const Path& rhs) const;
96 bool operator!=(const Path& rhs) const;
98
100
104 Path operator+(const PathSegment& rhs) const;
105 Path operator+(const PathComponent& rhs) const;
106 Path operator+(const std::string& rhs) const;
108
111 Path pop() const;
112
115 Path popSegment() const;
116
119 Path popHead() const;
120
124 Path head(int nbComponents) const;
125
128 PathComponent back() const;
129
133 Path sibling(const PathComponent& newTail) const;
134
138 bool startsWith(const Path& prefix) const;
139
146 Path replaceComponent(int index, const PathComponent& replacement) const;
147
158 Path reparent(const Path& originalPrefix, const Path& newPrefix) const;
159
161
162 Components::const_iterator cbegin() const;
163 Components::const_iterator begin() const;
164 Components::const_iterator cend() const;
165 Components::const_iterator end() const;
166 Components::iterator begin();
167 Components::iterator end();
169
171 Rtid runTimeId() const;
172
174 const Segments& getSegments() const;
175
177 Segments::size_type nbSegments() const;
178
180 std::string string() const;
181
183 std::int32_t hash() const;
184
185private:
186
187 Segments fSegments;
188 // Provide support for component-based access and iteration. This
189 // doubles up space requirements, but components are not expensive
190 // (size of a shared pointer, typically two plain pointers).
191 Components fComponents;
192
193 // A Path is immutable, so its hash value can be cached once computed.
194 // -1 is an illegal hash value.
195 mutable std::int32_t fHashValue {-1};
196};
197
198}
199
200// Allow for use of Path with std::unordered_map.
201namespace std {
202template <> struct hash<UFE_VERSIONED_NS::Path> {
203 std::size_t operator()(const UFE_VERSIONED_NS::Path& path) const {return path.hash();}
204};
205}
206
207#endif /* _ufePath */
Constant string representation with fixed space and O(1) comparison.
Definition: pathComponent.h:33
Identify an object or 3D path in the scene.
Definition: path.h:38
Path(Segments &&segments) noexcept
std::vector< PathSegment > Segments
Definition: path.h:41
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:42
Path()=default
Default constructor. Creates an empty path.
Path(const Segments &segments)
Path(const PathSegment &segment)
std::int32_t hash() const
Path(PathSegment &&segment) noexcept
Move constructor.
A segment of a path within a single runtime.
Definition: pathSegment.h:36
std::vector< PathComponent > Components
Definition: pathSegment.h:39
Path path(const std::string &pathString)
uint32_t Rtid
Definition: rtid.h:26
Definition: path.h:201
std::size_t operator()(const Ufe_v5 ::Path &path) const
Definition: path.h:203
#define UFE_VERSIONED_NS
Definition: ufe.h:22
#define UFE_NS_DEF
Definition: ufe.h:35
#define UFE_SDK_DECL
Definition: ufeExport.h:36