HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HUSD_GetAttributes.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_GetAttributes_h__
19 #define __HUSD_GetAttributes_h__
20 
21 #include "HUSD_API.h"
22 #include "HUSD_DataHandle.h"
23 #include "HUSD_TimeCode.h"
24 #include <UT/UT_StringHolder.h>
25 
26 enum class HUSD_TimeSampling;
27 
28 
30 {
31 public:
34 
35  /// @{ Obtains attribute or primvar value.
36  template<typename UtValueType>
37  bool getAttribute(const UT_StringRef &primpath,
38  const UT_StringRef &attribname,
39  UtValueType &value,
40  const HUSD_TimeCode &timecode) const;
41 
42  template<typename UtValueType>
43  bool getPrimvar(const UT_StringRef &primpath,
44  const UT_StringRef &primvarname,
45  UtValueType &value,
46  const HUSD_TimeCode &timecode,
47  bool allow_inheritance = false) const;
48 
49  template<typename UtValueType>
50  bool getAttributeOrPrimvar(const UT_StringRef &primpath,
51  const UT_StringRef &name,
52  UtValueType &value,
53  const HUSD_TimeCode &timecode) const;
54  /// @}
55 
56 
57  /// @{ Obtains attribute or primvar array value.
58  // The following methods perform exactly the same thing as the aboves,
59  // but accept the subclasses from the UT_Array.
60  template<typename UtValueType>
61  bool getAttributeArray(const UT_StringRef &primpath,
62  const UT_StringRef &attribname,
63  UT_Array<UtValueType> &value,
64  const HUSD_TimeCode &timecode) const
65  { return getAttribute(primpath, attribname, value, timecode); }
66 
67  template<typename UtValueType>
68  bool getPrimvarArray(const UT_StringRef &primpath,
69  const UT_StringRef &primvarname,
70  UT_Array<UtValueType> &value,
71  const HUSD_TimeCode &timecode,
72  bool allow_inheritance = false) const
73  { return getPrimvar(primpath, primvarname, value, timecode,
74  allow_inheritance); }
75 
76  template<typename UtValueType>
78  const UT_StringRef &name,
79  UT_Array<UtValueType> &value,
80  const HUSD_TimeCode &timecode) const
81  { return getAttributeOrPrimvar(primpath, name, value, timecode); }
82  /// @}
83 
84  /// Obtains the size of an array attribute (0 if the attribute
85  /// is not an array)
86  bool getAttributeArraySize(const UT_StringRef &primpath,
87  const UT_StringRef &attribname,
88  size_t &arraylength,
89  const HUSD_TimeCode &timecode) const;
90 
91  /// Obtains array value of a flattened primvar.
92  template<typename UtValueType>
93  bool getFlattenedPrimvar(const UT_StringRef &primpath,
94  const UT_StringRef &primvarname,
95  UT_Array<UtValueType> &value,
96  const HUSD_TimeCode &timecode,
97  bool allow_inheritance = false) const;
98 
99  /// Returns true if the primvar is indexed.
100  bool isPrimvarIndexed(const UT_StringRef &primpath,
101  const UT_StringRef &primvarname,
102  bool allow_inheritance = false) const;
103 
104  /// Returns the index array for indexed primvars.
105  bool getPrimvarIndices(const UT_StringRef &primpath,
106  const UT_StringRef &primvarname,
108  const HUSD_TimeCode &timecode,
109  bool allow_inheritance = false) const;
110 
111  /// Returns the interpolation style of a primvar.
112  UT_StringHolder getPrimvarInterpolation(const UT_StringRef &primpath,
113  const UT_StringRef &primvarname,
114  bool allow_inheritance = false) const;
115 
116  /// Returns the exlement size of a primvar.
117  exint getPrimvarElementSize(const UT_StringRef &primpath,
118  const UT_StringRef &primvarname,
119  bool allow_inheritance = false) const;
120 
121 
122  /// Returns true if any attribute we have fetched has many time samples.
123  bool getIsTimeVarying() const;
124 
125  /// Returns the overal sampling of fethced attributes.
127  { return myTimeSampling; }
128 
129 private:
130  HUSD_AutoAnyLock &myAnyLock;
131  mutable HUSD_TimeSampling myTimeSampling;
132 };
133 #endif
GLsizei GLenum const void * indices
Definition: glcorearb.h:406
int64 exint
Definition: SYS_Types.h:125
#define HUSD_API
Definition: HUSD_API.h:32
bool getPrimvarArray(const UT_StringRef &primpath, const UT_StringRef &primvarname, UT_Array< UtValueType > &value, const HUSD_TimeCode &timecode, bool allow_inheritance=false) const
Obtains attribute or primvar array value.
HUSD_TimeSampling getTimeSampling() const
Returns the overal sampling of fethced attributes.
HUSD_TimeSampling
Definition: HUSD_Utils.h:98
GLuint const GLchar * name
Definition: glcorearb.h:786
bool getAttributeOrPrimvarArray(const UT_StringRef &primpath, const UT_StringRef &name, UT_Array< UtValueType > &value, const HUSD_TimeCode &timecode) const
Obtains attribute or primvar array value.
Definition: core.h:1131
bool getAttributeArray(const UT_StringRef &primpath, const UT_StringRef &attribname, UT_Array< UtValueType > &value, const HUSD_TimeCode &timecode) const
Obtains attribute or primvar array value.