HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
typedesc.h
Go to the documentation of this file.
1 /*
2  Copyright 2008 Larry Gritz and the other authors and contributors.
3  All Rights Reserved.
4 
5  Redistribution and use in source and binary forms, with or without
6  modification, are permitted provided that the following conditions are
7  met:
8  * Redistributions of source code must retain the above copyright
9  notice, this list of conditions and the following disclaimer.
10  * Redistributions in binary form must reproduce the above copyright
11  notice, this list of conditions and the following disclaimer in the
12  documentation and/or other materials provided with the distribution.
13  * Neither the name of the software's owners nor the names of its
14  contributors may be used to endorse or promote products derived from
15  this software without specific prior written permission.
16  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28  (This is the Modified BSD License)
29 */
30 
31 // clang-format off
32 
33 /// \file
34 /// The TypeDesc class is used to describe simple data types.
35 
36 
37 #pragma once
38 
39 #if defined(_MSC_VER)
40 // Ignore warnings about conditional expressions that always evaluate true
41 // on a given platform but may evaluate differently on another. There's
42 // nothing wrong with such conditionals.
43 # pragma warning(disable : 4127)
44 #endif
45 
46 #include <cmath>
47 #include <cstddef>
48 #include <iostream>
49 #include <limits>
50 
51 #include <OpenImageIO/dassert.h>
52 #include <OpenImageIO/export.h>
55 
56 
58 
59 /////////////////////////////////////////////////////////////////////////////
60 /// A TypeDesc describes simple data types.
61 ///
62 /// It frequently comes up (in my experience, with renderers and image
63 /// handling programs) that you want a way to describe data that is passed
64 /// through APIs through blind pointers. These are some simple classes
65 /// that provide a simple type descriptor system. This is not meant to
66 /// be comprehensive -- for example, there is no provision for structs,
67 /// unions, pointers, const, or 'nested' type definitions. Just simple
68 /// integer and floating point, *common* aggregates such as 3-points,
69 /// and reasonably-lengthed arrays thereof.
70 ///
71 /////////////////////////////////////////////////////////////////////////////
72 
74  /// BASETYPE is a simple enum for the C/C++ built-in types.
75  ///
76  enum BASETYPE { UNKNOWN, NONE,
77  UCHAR, UINT8=UCHAR, CHAR, INT8=CHAR,
78  USHORT, UINT16=USHORT, SHORT, INT16=SHORT,
79  UINT, UINT32=UINT, INT, INT32=INT,
80  ULONGLONG, UINT64=ULONGLONG, LONGLONG, INT64=LONGLONG,
81  HALF, FLOAT, DOUBLE, STRING, PTR, LASTBASE };
82  /// AGGREGATE describes whether our type is a simple scalar of
83  /// one of the BASETYPE's, or one of several simple aggregates.
84  enum AGGREGATE {
85  SCALAR = 1,
86  VEC2 = 2,
87  VEC3 = 3,
88  VEC4 = 4,
89  MATRIX33 = 9,
90  MATRIX44 = 16
91  };
92  /// VECSEMANTICS gives hints about what the data represent (for
93  /// example, if a spatial vector, whether it should transform as
94  /// a point, direction vector, or surface normal).
95  enum VECSEMANTICS {
96  NOXFORM = 0,
97  NOSEMANTICS = 0, // no semantic hints
98  COLOR, // color
99  POINT, // spatial location
100  VECTOR, // spatial direction
101  NORMAL, // surface normal
102  TIMECODE, // SMPTE timecode (should be int[2])
103  KEYCODE, // SMPTE keycode (should be int[7])
104  RATIONAL // paired numerator and denominator
105  };
106 
107  unsigned char basetype; ///< C data type at the heart of our type
108  unsigned char aggregate; ///< What kind of AGGREGATE is it?
109  unsigned char vecsemantics; ///< What does the vec represent?
110  unsigned char reserved; ///< Reserved for future expansion
111  int arraylen; ///< Array length, 0 = not array, -1 = unsized
112 
113  /// Construct from a BASETYPE and optional aggregateness and
114  /// transformation rules.
115  constexpr TypeDesc (BASETYPE btype=UNKNOWN, AGGREGATE agg=SCALAR,
116  VECSEMANTICS xform=NOXFORM)
117  : basetype(static_cast<unsigned char>(btype)),
118  aggregate(static_cast<unsigned char>(agg)),
119  vecsemantics(static_cast<unsigned char>(xform)), reserved(0),
120  arraylen(0)
121  { }
122 
123  /// Construct an array of a non-aggregate BASETYPE.
124  ///
125  constexpr TypeDesc (BASETYPE btype, int arraylength)
126  : basetype(static_cast<unsigned char>(btype)),
127  aggregate(SCALAR), vecsemantics(NOXFORM),
128  reserved(0), arraylen(arraylength)
129  { }
130 
131  /// Construct an array from BASETYPE, AGGREGATE, and array length,
132  /// with unspecified (or moot) vector transformation semantics.
133  constexpr TypeDesc (BASETYPE btype, AGGREGATE agg, int arraylength)
134  : basetype(static_cast<unsigned char>(btype)),
135  aggregate(static_cast<unsigned char>(agg)),
136  vecsemantics(NOXFORM), reserved(0),
137  arraylen(arraylength)
138  { }
139 
140  /// Construct an array from BASETYPE, AGGREGATE, VECSEMANTICS, and
141  /// array length.
142  constexpr TypeDesc (BASETYPE btype, AGGREGATE agg,
143  VECSEMANTICS xform, int arraylength)
144  : basetype(static_cast<unsigned char>(btype)),
145  aggregate(static_cast<unsigned char>(agg)),
146  vecsemantics(static_cast<unsigned char>(xform)),
147  reserved(0), arraylen(arraylength)
148  { }
149 
150  /// Construct from a string (e.g., "float[3]"). If no valid
151  /// type could be assembled, set base to UNKNOWN.
152  TypeDesc (string_view typestring);
153 
154  /// Copy constructor.
155  constexpr TypeDesc (const TypeDesc &t)
156  : basetype(t.basetype), aggregate(t.aggregate),
157  vecsemantics(t.vecsemantics), reserved(0), arraylen(t.arraylen)
158  { }
159 
160 
161  /// Return the name, for printing and whatnot. For example,
162  /// "float", "int[5]", "normal"
163  const char *c_str() const;
164 
165  friend std::ostream& operator<< (std::ostream& o, TypeDesc t) {
166  o << t.c_str(); return o;
167  }
168 
169  /// Return the number of elements: 1 if not an array, or the array
170  /// length. Invalid to call this for arrays of undetermined size.
171  OIIO_CONSTEXPR14 size_t numelements () const {
172  DASSERT_MSG (arraylen >= 0, "Called numelements() on TypeDesc "
173  "of array with unspecified length (%d)", arraylen);
174  return (arraylen >= 1 ? arraylen : 1);
175  }
176 
177  /// Return the number of basetype values: the aggregate count multiplied
178  /// by the array length (or 1 if not an array). Invalid to call this
179  /// for arrays of undetermined size.
180  OIIO_CONSTEXPR14 size_t basevalues () const {
181  return numelements() * aggregate;
182  }
183 
184  /// Does this TypeDesc describe an array?
185  constexpr bool is_array () const { return (arraylen != 0); }
186 
187  /// Does this TypeDesc describe an array, but whose length is not
188  /// specified?
189  constexpr bool is_unsized_array () const { return (arraylen < 0); }
190 
191  /// Does this TypeDesc describe an array, whose length is specified?
192  constexpr bool is_sized_array () const { return (arraylen > 0); }
193 
194  /// Return the size, in bytes, of this type.
195  ///
196  size_t size () const {
197  DASSERT_MSG (arraylen >= 0, "Called size() on TypeDesc "
198  "of array with unspecified length (%d)", arraylen);
199  size_t a = (size_t) (arraylen > 0 ? arraylen : 1);
200  if (sizeof(size_t) > sizeof(int)) {
201  // size_t has plenty of room for this multiplication
202  return a * elementsize();
203  } else {
204  // need overflow protection
205  unsigned long long s = (unsigned long long) a * elementsize();
206  const size_t toobig = std::numeric_limits<size_t>::max();
207  return s < toobig ? (size_t)s : toobig;
208  }
209  }
210 
211  /// Return the type of one element, i.e., strip out the array-ness.
212  ///
213  OIIO_CONSTEXPR14 TypeDesc elementtype () const {
214  TypeDesc t (*this); t.arraylen = 0; return t;
215  }
216 
217  /// Return the size, in bytes, of one element of this type (that is,
218  /// ignoring whether it's an array).
219  size_t elementsize () const { return aggregate * basesize(); }
220 
221  // /// Return just the underlying C scalar type, i.e., strip out the
222  // /// array-ness and the aggregateness.
223 // BASETYPE basetype () const { return TypeDesc(base); }
224 
225  /// Return the base type size, i.e., stripped of both array-ness
226  /// and aggregateness.
227  size_t basesize () const;
228 
229  /// True if it's a floating-point type (versus a fundamentally
230  /// integral type or something else like a string).
231  bool is_floating_point () const;
232 
233  /// True if it's a signed type that allows for negative values.
234  bool is_signed () const;
235 
236  /// Shortcut: is it UNKNOWN?
237  constexpr bool is_unknown () const { return (basetype == UNKNOWN); }
238 
239  /// if (typespec) is the same as asking whether it's not UNKNOWN.
240  constexpr operator bool () const { return (basetype != UNKNOWN); }
241 
242  /// Set *this to the type described in the string. Return the
243  /// length of the part of the string that describes the type. If
244  /// no valid type could be assembled, return 0 and do not modify
245  /// *this.
246  size_t fromstring (string_view typestring);
247 
248  /// Compare two TypeDesc values for equality.
249  ///
250  constexpr bool operator== (const TypeDesc &t) const {
251  return basetype == t.basetype && aggregate == t.aggregate &&
252  vecsemantics == t.vecsemantics && arraylen == t.arraylen;
253  }
254 
255  /// Compare two TypeDesc values for inequality.
256  ///
257  constexpr bool operator!= (const TypeDesc &t) const { return ! (*this == t); }
258 
259  /// Compare a TypeDesc to a basetype (it's the same if it has the
260  /// same base type and is not an aggregate or an array).
261  friend constexpr bool operator== (const TypeDesc &t, BASETYPE b) {
262  return (BASETYPE)t.basetype == b && (AGGREGATE)t.aggregate == SCALAR && !t.is_array();
263  }
264  friend constexpr bool operator== (BASETYPE b, const TypeDesc &t) {
265  return (BASETYPE)t.basetype == b && (AGGREGATE)t.aggregate == SCALAR && !t.is_array();
266  }
267 
268  /// Compare a TypeDesc to a basetype (it's the same if it has the
269  /// same base type and is not an aggregate or an array).
270  friend constexpr bool operator!= (const TypeDesc &t, BASETYPE b) {
271  return (BASETYPE)t.basetype != b || (AGGREGATE)t.aggregate != SCALAR || t.is_array();
272  }
273  friend constexpr bool operator!= (BASETYPE b, const TypeDesc &t) {
274  return (BASETYPE)t.basetype != b || (AGGREGATE)t.aggregate != SCALAR || t.is_array();
275  }
276 
277  /// TypeDesc's are equivalent if they are equal, or if their only
278  /// inequality is differing vector semantics.
279  friend constexpr bool equivalent (const TypeDesc &a, const TypeDesc &b) {
280  return a.basetype == b.basetype && a.aggregate == b.aggregate &&
281  (a.arraylen == b.arraylen || (a.is_unsized_array() && b.is_sized_array())
282  || (a.is_sized_array() && b.is_unsized_array()));
283  }
284  /// Member version of equivalent
285  constexpr bool equivalent (const TypeDesc &b) const {
286  return this->basetype == b.basetype && this->aggregate == b.aggregate &&
287  (this->arraylen == b.arraylen || (this->is_unsized_array() && b.is_sized_array())
288  || (this->is_sized_array() && b.is_unsized_array()));
289  }
290 
291  /// Is this a 3-vector aggregate (of the given type, float by default)?
292  constexpr bool is_vec3 (BASETYPE b=FLOAT) const {
293  return this->aggregate == VEC3 && this->basetype == b && !is_array();
294  }
295 
296  /// Is this a 4-vector aggregate (of the given type, float by default)?
297  constexpr bool is_vec4 (BASETYPE b=FLOAT) const {
298  return this->aggregate == VEC4 && this->basetype == b && !is_array();
299  }
300 
301  /// Demote the type to a non-array
302  ///
303  void unarray (void) { arraylen = 0; }
304 
305  /// Test for lexicographic 'less', comes in handy for lots of STL
306  /// containers and algorithms.
307  bool operator< (const TypeDesc &x) const;
308 
309  // DEPRECATED(1.8): These static const member functions were mildly
310  // problematic because they required external linkage (and possibly
311  // even static initialization order fiasco) and were a memory reference
312  // that incurred some performance penalty and inability to optimize.
313  // Please instead use the out-of-class constexpr versions below. We
314  // will eventually remove these.
315  static const TypeDesc TypeFloat;
316  static const TypeDesc TypeColor;
317  static const TypeDesc TypeString;
318  static const TypeDesc TypeInt;
319  static const TypeDesc TypeHalf;
320  static const TypeDesc TypePoint;
321  static const TypeDesc TypeVector;
322  static const TypeDesc TypeNormal;
323  static const TypeDesc TypeMatrix;
324  static const TypeDesc TypeMatrix33;
325  static const TypeDesc TypeMatrix44;
326  static const TypeDesc TypeTimeCode;
327  static const TypeDesc TypeKeyCode;
328  static const TypeDesc TypeFloat4;
329  static const TypeDesc TypeRational;
330 };
331 
332 
333 
334 
335 // Static values for commonly used types. Because these are constexpr,
336 // they should incur no runtime construction cost and should optimize nicely
337 // in various ways.
338 static constexpr TypeDesc TypeUnknown (TypeDesc::UNKNOWN);
339 static constexpr TypeDesc TypeFloat (TypeDesc::FLOAT);
340 static constexpr TypeDesc TypeColor (TypeDesc::FLOAT, TypeDesc::VEC3, TypeDesc::COLOR);
341 static constexpr TypeDesc TypePoint (TypeDesc::FLOAT, TypeDesc::VEC3, TypeDesc::POINT);
342 static constexpr TypeDesc TypeVector (TypeDesc::FLOAT, TypeDesc::VEC3, TypeDesc::VECTOR);
343 static constexpr TypeDesc TypeNormal (TypeDesc::FLOAT, TypeDesc::VEC3, TypeDesc::NORMAL);
344 static constexpr TypeDesc TypeMatrix33 (TypeDesc::FLOAT, TypeDesc::MATRIX33);
345 static constexpr TypeDesc TypeMatrix44 (TypeDesc::FLOAT, TypeDesc::MATRIX44);
346 static constexpr TypeDesc TypeMatrix = TypeMatrix44;
347 static constexpr TypeDesc TypeString (TypeDesc::STRING);
348 static constexpr TypeDesc TypeInt (TypeDesc::INT);
349 static constexpr TypeDesc TypeUInt (TypeDesc::UINT);
350 static constexpr TypeDesc TypeInt32 (TypeDesc::INT);
351 static constexpr TypeDesc TypeUInt32 (TypeDesc::UINT);
352 static constexpr TypeDesc TypeInt16 (TypeDesc::INT16);
353 static constexpr TypeDesc TypeUInt16 (TypeDesc::UINT16);
354 static constexpr TypeDesc TypeInt8 (TypeDesc::INT8);
355 static constexpr TypeDesc TypeUInt8 (TypeDesc::UINT8);
356 static constexpr TypeDesc TypeHalf (TypeDesc::HALF);
357 static constexpr TypeDesc TypeTimeCode (TypeDesc::UINT, TypeDesc::SCALAR, TypeDesc::TIMECODE, 2);
358 static constexpr TypeDesc TypeKeyCode (TypeDesc::INT, TypeDesc::SCALAR, TypeDesc::KEYCODE, 7);
359 static constexpr TypeDesc TypeFloat4 (TypeDesc::FLOAT, TypeDesc::VEC4);
360 static constexpr TypeDesc TypeRational(TypeDesc::INT, TypeDesc::VEC2, TypeDesc::RATIONAL);
361 
362 
363 
364 /// Return a string containing the data values formatted according
365 /// to the type and the optional formatting arguments.
366 std::string tostring (TypeDesc type, const void *data,
367  const char *float_fmt = "%f", // E.g. "%g"
368  const char *string_fmt = "%s", // E.g. "\"%s\""
369  const char aggregate_delim[2] = "()", // Both sides of vector
370  const char *aggregate_sep = ",", // E.g. ", "
371  const char array_delim[2] = "{}", // Both sides of array
372  const char *array_sep = ","); // E.g. "; "
373 
374 
375 
376 /// A template mechanism for getting the a base type from C type
377 ///
378 template<typename T> struct BaseTypeFromC {};
379 template<> struct BaseTypeFromC<unsigned char> { static const TypeDesc::BASETYPE value = TypeDesc::UINT8; };
380 template<> struct BaseTypeFromC<char> { static const TypeDesc::BASETYPE value = TypeDesc::INT8; };
381 template<> struct BaseTypeFromC<unsigned short> { static const TypeDesc::BASETYPE value = TypeDesc::UINT16; };
382 template<> struct BaseTypeFromC<short> { static const TypeDesc::BASETYPE value = TypeDesc::INT16; };
383 template<> struct BaseTypeFromC<unsigned int> { static const TypeDesc::BASETYPE value = TypeDesc::UINT; };
384 template<> struct BaseTypeFromC<int> { static const TypeDesc::BASETYPE value = TypeDesc::INT; };
385 template<> struct BaseTypeFromC<unsigned long long> { static const TypeDesc::BASETYPE value = TypeDesc::UINT64; };
386 template<> struct BaseTypeFromC<long long> { static const TypeDesc::BASETYPE value = TypeDesc::INT64; };
387 #ifdef _HALF_H_
388 template<> struct BaseTypeFromC<half> { static const TypeDesc::BASETYPE value = TypeDesc::HALF; };
389 #endif
390 template<> struct BaseTypeFromC<float> { static const TypeDesc::BASETYPE value = TypeDesc::FLOAT; };
391 template<> struct BaseTypeFromC<double> { static const TypeDesc::BASETYPE value = TypeDesc::DOUBLE; };
392 
393 
394 
395 /// A template mechanism for getting C type of TypeDesc::BASETYPE.
396 ///
397 template<int b> struct CType {};
398 template<> struct CType<(int)TypeDesc::UINT8> { typedef unsigned char type; };
399 template<> struct CType<(int)TypeDesc::INT8> { typedef char type; };
400 template<> struct CType<(int)TypeDesc::UINT16> { typedef unsigned short type; };
401 template<> struct CType<(int)TypeDesc::INT16> { typedef short type; };
402 template<> struct CType<(int)TypeDesc::UINT> { typedef unsigned int type; };
403 template<> struct CType<(int)TypeDesc::INT> { typedef int type; };
404 template<> struct CType<(int)TypeDesc::UINT64> { typedef unsigned long long type; };
405 template<> struct CType<(int)TypeDesc::INT64> { typedef long long type; };
406 #ifdef _HALF_H_
407 template<> struct CType<(int)TypeDesc::HALF> { typedef half type; };
408 #endif
409 template<> struct CType<(int)TypeDesc::FLOAT> { typedef float type; };
410 template<> struct CType<(int)TypeDesc::DOUBLE> { typedef double type; };
411 
412 
GLdouble s
Definition: glew.h:1390
vint4 max(const vint4 &a, const vint4 &b)
Definition: simd.h:4703
static const TypeDesc TypeFloat
Definition: typedesc.h:315
constexpr bool is_vec3(BASETYPE b=FLOAT) const
Is this a 3-vector aggregate (of the given type, float by default)?
Definition: typedesc.h:292
static const TypeDesc TypeColor
Definition: typedesc.h:316
size_t size() const
Definition: typedesc.h:196
OIIO_CONSTEXPR14 TypeDesc elementtype() const
Definition: typedesc.h:213
static const TypeDesc TypeVector
Definition: typedesc.h:321
static const TypeDesc TypeMatrix
Definition: typedesc.h:323
GLboolean GLboolean GLboolean GLboolean a
Definition: glew.h:9477
std::string tostring(TypeDesc type, const void *data, const char *float_fmt="%f", const char *string_fmt="%s", const char aggregate_delim[2]="()", const char *aggregate_sep=",", const char array_delim[2]="{}", const char *array_sep=",")
constexpr TypeDesc(BASETYPE btype, AGGREGATE agg, VECSEMANTICS xform, int arraylength)
Definition: typedesc.h:142
constexpr TypeDesc(BASETYPE btype, AGGREGATE agg, int arraylength)
Definition: typedesc.h:133
constexpr bool is_unsized_array() const
Definition: typedesc.h:189
static const TypeDesc TypeHalf
Definition: typedesc.h:319
static const TypeDesc TypePoint
Definition: typedesc.h:320
static const TypeDesc TypeRational
Definition: typedesc.h:329
unsigned char basetype
C data type at the heart of our type.
Definition: typedesc.h:107
unsigned char reserved
Reserved for future expansion.
Definition: typedesc.h:110
constexpr bool is_vec4(BASETYPE b=FLOAT) const
Is this a 4-vector aggregate (of the given type, float by default)?
Definition: typedesc.h:297
std::ostream & operator<<(std::ostream &ostr, const DataType &a)
Definition: DataType.h:133
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:137
typedef INT(WINAPI *PFNWGLGETGPUINFOAMDPROC)(UINT id
static const TypeDesc TypeKeyCode
Definition: typedesc.h:327
constexpr TypeDesc(BASETYPE btype, int arraylength)
Definition: typedesc.h:125
GLint GLint GLint GLint GLint x
Definition: glew.h:1252
friend constexpr bool equivalent(const TypeDesc &a, const TypeDesc &b)
Definition: typedesc.h:279
constexpr bool is_array() const
Does this TypeDesc describe an array?
Definition: typedesc.h:185
static const TypeDesc TypeNormal
Definition: typedesc.h:322
static const TypeDesc TypeMatrix44
Definition: typedesc.h:325
GLint GLenum GLsizei GLint GLsizei const void * data
Definition: glew.h:1379
unsigned char aggregate
What kind of AGGREGATE is it?
Definition: typedesc.h:108
static const TypeDesc TypeTimeCode
Definition: typedesc.h:326
constexpr TypeDesc(const TypeDesc &t)
Copy constructor.
Definition: typedesc.h:155
bool operator<(const GU_TetrahedronFacet &a, const GU_TetrahedronFacet &b)
typedef int(WINAPI *PFNWGLRELEASEPBUFFERDCARBPROC)(HPBUFFERARB hPbuffer
static const TypeDesc TypeMatrix33
Definition: typedesc.h:324
static const TypeDesc TypeString
Definition: typedesc.h:317
OIIO_CONSTEXPR14 size_t basevalues() const
Definition: typedesc.h:180
GLuint GLuint GLsizei GLenum type
Definition: glew.h:1253
static const TypeDesc TypeInt
Definition: typedesc.h:318
const char * c_str() const
constexpr bool equivalent(const TypeDesc &b) const
Member version of equivalent.
Definition: typedesc.h:285
GLdouble GLdouble GLdouble b
Definition: glew.h:9122
GLsizei const GLchar *const * string
Definition: glew.h:1844
#define SCALAR(T)
Simplify checking for scalar types.
Definition: GA_Handle.h:412
#define DASSERT_MSG
Definition: dassert.h:109
static const TypeDesc TypeFloat4
Definition: typedesc.h:328
size_t elementsize() const
Definition: typedesc.h:219
constexpr TypeDesc(BASETYPE btype=UNKNOWN, AGGREGATE agg=SCALAR, VECSEMANTICS xform=NOXFORM)
Definition: typedesc.h:115
VECSEMANTICS
Definition: typedesc.h:95
OIIO_CONSTEXPR14 size_t numelements() const
Definition: typedesc.h:171
int arraylen
Array length, 0 = not array, -1 = unsized.
Definition: typedesc.h:111
constexpr bool is_unknown() const
Shortcut: is it UNKNOWN?
Definition: typedesc.h:237
typedef INT64(WINAPI *PFNWGLSWAPBUFFERSMSCOMLPROC)(HDC hdc
bool operator!=(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:165
void unarray(void)
Definition: typedesc.h:303
#define OIIO_NAMESPACE_END
Definition: oiioversion.h:66
unsigned long long type
Definition: typedesc.h:404
constexpr bool is_sized_array() const
Does this TypeDesc describe an array, whose length is specified?
Definition: typedesc.h:192
GLsizei const GLfloat * value
Definition: glew.h:1849
Definition: half.h:91
GLdouble GLdouble t
Definition: glew.h:1398
unsigned char vecsemantics
What does the vec represent?
Definition: typedesc.h:109
type
Definition: core.h:528
#define OIIO_NAMESPACE_BEGIN
Definition: oiioversion.h:65
#define OIIO_API
Definition: export.h:91