HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
VEX_RefObject.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: VEX_RefObject.h ( VEX Library, C++)
7  *
8  * COMMENTS: A runtime reference-counted type for VEX. The reference
9  * count is initialized to 0.
10  */
11 
12 #ifndef __VEX_RefObject__
13 #define __VEX_RefObject__
14 
15 #include "VEX_API.h"
16 #include <UT/UT_WorkBuffer.h>
17 #include <UT/UT_IntrusivePtr.h>
18 #include <UT/UT_ValArray.h>
19 #include "VEX_PodTypes.h"
20 
21 template <VEX_Precision PREC> class VEX_SymbolTable;
22 
23 class VEX_Assemble;
25 
26 // A custom reference counted type definition
28 {
29 public:
31 
32  const UT_StringHolder &getName() const { return myName; }
33 
34  // Only for memory debugging
35  static void clearRefTypes();
36 
37 private:
38  UT_StringHolder myName;
39 };
40 
41 // A reference counted runtime object
43  : public UT_IntrusiveRefCounter<VEX_RefObject>
44 {
45 public:
46  VEX_RefObject();
47  virtual ~VEX_RefObject();
48 
49  virtual const char *className() const = 0;
50 
51  int getRefCount() { return use_count(); }
52 
53  virtual bool isEqual(const VEX_RefObject &rhs) const = 0;
54  virtual void dump(UT_WorkBuffer &buf, int indent = 0) const = 0;
55  void dump() const;
56 
57  /// Flatten parameter values into per-type arrays. If you've already
58  /// called duplicate(), the result of flatten() will produce data
59  /// arrays that match by index with the original object. Traversal is
60  /// preorder.
61  virtual void flatten(UT_ValArray<VEX_RefObject *> &objs,
63  UT_ValArray<float *> &floats) = 0;
64 
65  /// Find a method by name, and return the shader and arguments
66  /// associated with it. If the method does not exist, return 0.
67  virtual VEX_AssemblePtr getMethod(const char *name,
68  const VEX_SymbolTable<VEX_32> *&args);
69  virtual VEX_AssemblePtr getMethod(const char *name,
70  const VEX_SymbolTable<VEX_64> *&args);
71 
72 private:
73 };
74 
76 
77 #endif
SYS_FORCE_INLINE uint32 use_count() const
Return current counter.
const UT_StringHolder & getName() const
Definition: VEX_RefObject.h:32
#define VEX_API
Definition: VEX_API.h:11
A reference counter base class for use with UT_IntrusivePtr.
GLuint const GLchar * name
Definition: glcorearb.h:785
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glcorearb.h:2539
UT_IntrusivePtr< VEX_RefObject > VEX_ObjectHandle
Definition: VEX_RefObject.h:75