HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GR_SceneItem.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: GR_SceneItem.h (GR Library, C++)
7  *
8  * COMMENTS:
9  */
10 #ifndef GR_SceneItem_h
11 #define GR_SceneItem_h
12 
13 #include <UT/UT_NonCopyable.h>
14 #include <UT/UT_StringHolder.h>
15 #include <SYS/SYS_AtomicInt.h>
16 #include <SYS/SYS_Types.h>
17 
18 /// Base class for various things that can appear in a scene outside of geometry
20 {
21 public:
22  // Identification
23  const UT_StringHolder &name() const { return myName; }
24  exint id() const { return myID; }
25 
26  // Version control
27  int64 getVersion() const { return myVersion; }
28  void setVersion(int64 v) { myVersion = v; }
29 
30  //
31  void incref()
32  { myRefCount.add(1); }
33  void decref()
34  {
35  if (!myRefCount.add(-1))
36  delete this;
37  }
38 
39  void setName(const UT_StringHolder &name) { myName = name; }
40  void setID(int id) { myID = id; }
41 
42 protected:
44  : myName(name), myID(id) {}
45  virtual ~GR_SceneItem() {}
46 
48 
49 private:
50  UT_StringHolder myName;
51  exint myID;
52  int64 myVersion = 0;
53  SYS_AtomicInt32 myRefCount;
54 };
55 
56 static inline void intrusive_ptr_add_ref(GR_SceneItem *i) { i->incref(); }
57 static inline void intrusive_ptr_release(GR_SceneItem *i) { i->decref(); }
58 
59 #endif
Base class for various things that can appear in a scene outside of geometry.
Definition: GR_SceneItem.h:19
const GLdouble * v
Definition: glcorearb.h:837
void decref()
Definition: GR_SceneItem.h:33
int64 exint
Definition: SYS_Types.h:125
UT_NON_COPYABLE(GR_SceneItem)
void setID(int id)
Definition: GR_SceneItem.h:40
void setName(const UT_StringHolder &name)
Definition: GR_SceneItem.h:39
int64 getVersion() const
Definition: GR_SceneItem.h:27
long long int64
Definition: SYS_Types.h:116
GLuint const GLchar * name
Definition: glcorearb.h:786
const UT_StringHolder & name() const
Definition: GR_SceneItem.h:23
GR_SceneItem(const UT_StringHolder &name, int id)
Definition: GR_SceneItem.h:43
void setVersion(int64 v)
Definition: GR_SceneItem.h:28
T add(T val)
Atomically adds val to myValue, returning the new value of myValue.
virtual ~GR_SceneItem()
Definition: GR_SceneItem.h:45
void incref()
Definition: GR_SceneItem.h:31
exint id() const
Definition: GR_SceneItem.h:24