HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GA_PrimitiveTypeId.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: GA_PrimitiveTypeId.h ( GA Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __GA_PrimitiveTypeId__
12 #define __GA_PrimitiveTypeId__
13 
14 #include "GA_API.h"
15 
16 #include <SYS/SYS_Hash.h>
17 #include <SYS/SYS_Inline.h>
18 
19 /// Each primitive type is given a unique ID at run time. There are a number
20 /// of pre-defined factory types (see GEO_PrimType.h)
22 {
23 public:
24  /// Default c-tor
27  : myId(-1)
28  {}
29  /// Copy c-tor
32  : myId(src.myId)
33  {}
34  /// Assign from a factory type
37  : myId(id)
38  {}
39  /// Destructor
42  {}
43 
44  /// Assignment operator
47  {
48  myId = src.myId;
49  return *this;
50  }
51 
52  /// Return the integer value for the identifier. This can be used in
53  /// switches for factory types.
55  int get() const { return myId; }
56 
57  /// Returns true if this is a valid primitive id.
59  bool isValid() const { return myId >= 0; }
60 
61  /// @{
62  /// Compare the id to a "factory" primitive type (see GEO_PrimType.h)
64  bool operator==(int factory_id) const
65  { return myId == factory_id; }
67  bool operator!=(int factory_id) const
68  { return myId != factory_id; }
69  /// @}
70  /// @{
71  /// Compare to other primitive id's
73  bool operator==(const GA_PrimitiveTypeId &src) const
74  { return myId == src.myId; }
76  bool operator!=(const GA_PrimitiveTypeId &src) const
77  { return myId != src.myId; }
78  /// @}
79 
80 private:
82  void set(int id) { myId = id; }
83 
84  int myId;
85 };
86 
89 {
90  return SYShash(pi.get());
91 }
92 
93 #endif
SYS_FORCE_INLINE bool isValid() const
Returns true if this is a valid primitive id.
SYS_FORCE_INLINE ~GA_PrimitiveTypeId()
Destructor.
std::size_t SYS_HashType
Define the type for hash values.
Definition: SYS_Hash.h:19
#define GA_API
Definition: GA_API.h:12
SYS_FORCE_INLINE bool operator!=(const GA_PrimitiveTypeId &src) const
SYS_FORCE_INLINE bool operator==(int factory_id) const
GLuint id
Definition: glcorearb.h:654
#define SYS_FORCE_INLINE
Definition: SYS_Inline.h:45
SYS_FORCE_INLINE GA_PrimitiveTypeId(const GA_PrimitiveTypeId &src)
Copy c-tor.
SYS_FORCE_INLINE int get() const
SYS_FORCE_INLINE GA_PrimitiveTypeId(int id)
Assign from a factory type.
SYS_FORCE_INLINE GA_PrimitiveTypeId & operator=(const GA_PrimitiveTypeId &src)
Assignment operator.
SYS_FORCE_INLINE GA_PrimitiveTypeId()
Default c-tor.
SYS_FORCE_INLINE bool operator!=(int factory_id) const
size_t hash_value(const CH_ChannelRef &ref)
SYS_FORCE_INLINE bool operator==(const GA_PrimitiveTypeId &src) const
GLenum src
Definition: glcorearb.h:1792