HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HUSD_Path.h
Go to the documentation of this file.
1 /*
2  * Copyright 2019 Side Effects Software Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17 
18 #ifndef __HUSD_Path_h__
19 #define __HUSD_Path_h__
20 
21 #include "HUSD_API.h"
22 #include <UT/UT_WorkBuffer.h>
23 #include <iosfwd>
24 #include <stddef.h>
25 #include <pxr/pxr.h>
26 
28 class SdfPath;
30 
32 {
33 public:
34  HUSD_Path(const HUSD_Path &path);
35  HUSD_Path(const PXR_NS::SdfPath &path);
36  explicit HUSD_Path(const UT_StringRef &path);
37  HUSD_Path();
38  ~HUSD_Path();
39 
40  const PXR_NS::SdfPath &sdfPath() const;
41  size_t hash() const;
42 
43  const HUSD_Path &operator=(const HUSD_Path &path);
44  const HUSD_Path &operator=(const PXR_NS::SdfPath &path);
45  bool operator==(const HUSD_Path &path) const;
46  bool operator!=(const HUSD_Path &path) const;
47  bool operator<(const HUSD_Path &path) const;
48 
49  bool isEmpty() const;
50  bool isAbsoluteRootOrPrimPath() const;
51  bool hasPrefix(const HUSD_Path &prefix) const;
52 
53  HUSD_Path parentPath() const;
54  HUSD_Path primPath() const;
55  HUSD_Path appendChild(const UT_StringRef &name) const;
56  HUSD_Path appendProperty(const UT_StringRef &name) const;
57 
58  void pathStr(UT_WorkBuffer &outpath) const;
59  UT_StringHolder pathStr() const;
60  UT_StringHolder nameStr() const;
61 
62  // Return a python object holding an SdfPath python object.
63  void *getPythonPath() const;
64 
65  static const HUSD_Path theRootPrimPath;
66 
67  friend HUSD_API std::ostream &operator<<(std::ostream &os, const HUSD_Path &path);
68 
69 private:
70  // The size of an SdfPath object is 8. We create a block of data that
71  // we will treat as an SdfPath object within the implementation.
72  char mySdfPathData[8];
73 };
74 
76 {
77  return path.hash();
78 }
79 
80 HUSD_API std::ostream &operator<<(std::ostream &os, const HUSD_Path &path);
81 #endif
82 
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
#define HUSD_API
Definition: HUSD_API.h:32
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:137
static const HUSD_Path theRootPrimPath
Definition: HUSD_Path.h:65
#define SYS_FORCE_INLINE
Definition: SYS_Inline.h:45
bool operator<(const GU_TetrahedronFacet &a, const GU_TetrahedronFacet &b)
GLuint const GLchar * name
Definition: glcorearb.h:786
Definition: path.h:290
SYS_FORCE_INLINE size_t hash_value(const HUSD_Path &path)
Definition: HUSD_Path.h:75
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1432
LeafData & operator=(const LeafData &)=delete
HUSD_API std::ostream & operator<<(std::ostream &os, const HUSD_Path &path)
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:91
bool operator!=(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:165
size_t hash() const