HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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_Array.h>
19 #include <UT/UT_SharedPtr.h>
20 #include "VEX_PodTypes.h"
21 
22 template <VEX_Precision PREC> class VEX_SymbolTable;
23 
24 class VEX_Assemble;
26 
27 // A custom reference counted type definition
29 {
30 public:
32 
33  const UT_StringHolder &getName() const { return myName; }
34 
35  // Only for memory debugging
36  static void clearRefTypes();
37 
38 private:
39  UT_StringHolder myName;
40 };
41 
42 // A reference counted runtime object
44  : public UT_IntrusiveRefCounter<VEX_RefObject>
45 {
46 public:
47  VEX_RefObject();
48  virtual ~VEX_RefObject();
49 
50  virtual const char *className() const = 0;
51 
52  int getRefCount() { return use_count(); }
53 
54  virtual bool isEqual(const VEX_RefObject &rhs) const = 0;
55  virtual void dump(UT_WorkBuffer &buf, int indent = 0) const = 0;
56  void dump() const;
57 
58  /// Flatten parameter values into per-type arrays. If you've already
59  /// called duplicate(), the result of flatten() will produce data
60  /// arrays that match by index with the original object. Traversal is
61  /// preorder.
62  virtual void flatten(UT_Array<VEX_RefObject *> &objs,
63  UT_Array<UT_Vector3 *> &vectors,
64  UT_Array<float *> &floats) = 0;
65 
66  /// Find a method by name, and return the shader and arguments
67  /// associated with it. If the method does not exist, return 0.
68  /// The method @b must set @c args.
69  virtual VEX_AssemblePtr getMethod(const char *name,
71  virtual VEX_AssemblePtr getMethod(const char *name,
73 
74 private:
75 };
76 
78 
79 #endif
const UT_StringHolder & getName() const
Definition: VEX_RefObject.h:33
ImageBuf OIIO_API flatten(const ImageBuf &src, ROI roi={}, int nthreads=0)
GLuint const GLchar * name
Definition: glcorearb.h:785
#define VEX_API
Definition: VEX_API.h:14
A reference counter base class for use with UT_IntrusivePtr.
SYS_FORCE_INLINE uint32 use_count() const noexcept
Return current counter.
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
Definition: UT_SharedPtr.h:30
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glcorearb.h:2539
**If you just want to fire and args
Definition: thread.h:615
UT_IntrusivePtr< VEX_RefObject > VEX_ObjectHandle
Definition: VEX_RefObject.h:77