HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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_Inline.h>
17 
18 /// Each primitive type is given a unique ID at run time. There are a number
19 /// of pre-defined factory types (see GEO_PrimType.h)
21 {
22 public:
23  /// Default c-tor
26  : myId(-1)
27  {}
28  /// Copy c-tor
31  : myId(src.myId)
32  {}
33  /// Assign from a factory type
36  : myId(id)
37  {}
38  /// Destructor
41  {}
42 
43  /// Assignment operator
46  {
47  myId = src.myId;
48  return *this;
49  }
50 
51  /// Return the integer value for the identifier. This can be used in
52  /// switches for factory types.
54  int get() const { return myId; }
55 
56  /// Returns true if this is a valid primitive id.
58  bool isValid() const { return myId >= 0; }
59 
60  /// @{
61  /// Compare the id to a "factory" primitive type (see GEO_PrimType.h)
63  bool operator==(int factory_id) const
64  { return myId == factory_id; }
66  bool operator!=(int factory_id) const
67  { return myId != factory_id; }
68  /// @}
69  /// @{
70  /// Compare to other primitive id's
72  bool operator==(const GA_PrimitiveTypeId &src) const
73  { return myId == src.myId; }
75  bool operator!=(const GA_PrimitiveTypeId &src) const
76  { return myId != src.myId; }
77  /// @}
78 
79 private:
81  void set(int id) { myId = id; }
82 
83  int myId;
84 };
85 
86 #endif
SYS_FORCE_INLINE bool isValid() const
Returns true if this is a valid primitive id.
SYS_FORCE_INLINE ~GA_PrimitiveTypeId()
Destructor.
#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 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
SYS_FORCE_INLINE bool operator==(const GA_PrimitiveTypeId &src) const
GLenum src
Definition: glcorearb.h:1792