ufe  1.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 "E:/jenkins/workspace/ufe-full-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 
16 UFE_NS_DEF {
17 
18 class PathComponent;
19 
21 
38 {
39 public:
40 
41  typedef std::vector<PathSegment> Segments;
43 
45  Path() = default;
46 
52  Path(const Segments& segments);
53 
58  Path(const PathSegment& segment);
59 
61  Path(PathSegment&& segment) noexcept;
62 
64  Path(const Path&) = default;
65 
67  Path& operator=(const Path&) = default;
68 
70  Path(Path&&) noexcept;
71 
73  Path& operator=(Path&& rhs) noexcept;
74 
76  Components::size_type size() const;
77 
80  bool empty() const;
81 
83  bool operator==(const Path& rhs) const;
85  bool operator!=(const Path& rhs) const;
87 
89  Path operator+(const PathSegment& rhs) const;
94  Path operator+(const PathComponent& rhs) const;
95  Path operator+(const std::string& rhs) const;
97 
100  Path pop() const;
101 
104  Path popSegment() const;
105 
108  Path popHead() const;
109 
113  Path head(int nbComponents) const;
114 
117  PathComponent back() const;
118 
122  Path sibling(const PathComponent& newTail) const;
123 
127  bool startsWith(const Path& prefix) const;
128 
130  Components::const_iterator cbegin() const;
132  Components::const_iterator begin() const;
133  Components::const_iterator cend() const;
134  Components::const_iterator end() const;
135  Components::iterator begin();
136  Components::iterator end();
138 
140  Rtid runTimeId() const;
141 
143  const Segments& getSegments() const;
144 
146  std::string string() const;
147 
149  std::int32_t hash() const;
150 
151 private:
152 
153  Segments fSegments;
154  // At time of writing, unclear if we need random access to components.
155  // Assuming we do, and therefore copying over the components into a
156  // separate vector, which is doubling up space. If we don't, we could
157  // simply create an iterator class for components that would implement a
158  // double loop over the segments until you reach the last component of the
159  // last segment. PPT, 28-Sep-2017.
160  Components fComponents;
161 };
162 
163 }
164 
165 // Allow for use of Path with std::unordered_map.
166 namespace std {
167 template <> struct hash<UFE_VERSIONED_NS::Path> {
168  std::size_t operator()(const UFE_VERSIONED_NS::Path& path) const {return path.hash();}
169 };
170 }
171 
172 #endif /* _ufePath */
A segment of a path within a single run-time.
Definition: pathSegment.h:35
std::size_t operator()(const Ufe_v1 ::Path &path) const
Definition: path.h:168
PathSegment::Components Components
Definition: path.h:42
Constant string representation with fixed space and O(1) comparison.
Definition: pathComponent.h:33
Definition: path.h:166
std::vector< PathSegment > Segments
Definition: path.h:41
Identify an object or 3D path in the scene.
Definition: path.h:37
uint32_t Rtid
Definition: rtid.h:26
std::vector< PathComponent > Components
Definition: pathSegment.h:39
#define UFE_NS_DEF
Definition: ufe.h:35
#define UFE_VERSIONED_NS
Definition: ufe.h:22
#define UFE_SDK_DECL
Definition: ufeExport.h:36