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 <stddef.h>
24 #include <pxr/pxr.h>
25 
27 class SdfPath;
29 
31 {
32 public:
33  HUSD_Path(const HUSD_Path &path);
34  HUSD_Path(const PXR_NS::SdfPath &path);
35  explicit HUSD_Path(const UT_StringRef &path);
36  HUSD_Path();
37  ~HUSD_Path();
38 
39  const PXR_NS::SdfPath &sdfPath() const;
40  size_t hash() const;
41 
42  const HUSD_Path &operator=(const HUSD_Path &path);
43  const HUSD_Path &operator=(const PXR_NS::SdfPath &path);
44  bool operator==(const HUSD_Path &path) const;
45  bool operator!=(const HUSD_Path &path) const;
46  bool operator<(const HUSD_Path &path) const;
47 
48  bool isEmpty() const;
49  bool isAbsoluteRootOrPrimPath() const;
50  bool hasPrefix(const HUSD_Path &prefix) const;
51 
52  HUSD_Path parentPath() const;
53  HUSD_Path primPath() const;
54  HUSD_Path appendChild(const UT_StringRef &name) const;
55  HUSD_Path appendProperty(const UT_StringRef &name) const;
56 
57  void pathStr(UT_WorkBuffer &outpath) const;
58  UT_StringHolder pathStr() const;
59  UT_StringHolder nameStr() const;
60 
61  // Return a python object holding an SdfPath python object.
62  void *getPythonPath() const;
63 
64  static const HUSD_Path theRootPrimPath;
65 
66 private:
67  // The size of an SdfPath object is 8. We create a block of data that
68  // we will treat as an SdfPath object within the implementation.
69  char mySdfPathData[8];
70 };
71 
73 {
74  return path.hash();
75 }
76 
77 #endif
78 
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:64
#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:291
SYS_FORCE_INLINE size_t hash_value(const HUSD_Path &path)
Definition: HUSD_Path.h:72
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1441
#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