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 "VEX_PodTypes.h"
17 #include <UT/UT_Array.h>
18 #include <UT/UT_IntrusivePtr.h>
19 #include <UT/UT_NonCopyable.h>
20 #include <UT/UT_SharedPtr.h>
21 #include <UT/UT_WorkBuffer.h>
22 
23 template <VEX_Precision PREC> class VEX_SymbolTable;
24 
25 class VEX_Assemble;
27 
28 // A custom reference counted type definition
30 {
31 public:
33 
34  const UT_StringHolder &getName() const { return myName; }
35 
36  // Only for memory debugging
37  static void clearRefTypes();
38 
39 private:
40  UT_StringHolder myName;
41 };
42 
43 // A reference counted runtime object
45  : public UT_IntrusiveRefCounter<VEX_RefObject>
46 {
47 public:
48  VEX_RefObject();
49  virtual ~VEX_RefObject();
50 
52 
53  virtual const char *className() const = 0;
54 
55  int getRefCount() { return use_count(); }
56 
57  virtual bool isEqual(const VEX_RefObject &rhs) const = 0;
58  virtual void dump(UT_WorkBuffer &buf, int indent = 0) const = 0;
59  void dump() const;
60 
61  /// Flatten parameter values into per-type arrays. If you've already
62  /// called duplicate(), the result of flatten() will produce data
63  /// arrays that match by index with the original object. Traversal is
64  /// preorder.
65  virtual void flatten(UT_Array<VEX_RefObject *> &objs,
66  UT_Array<UT_Vector3 *> &vectors,
67  UT_Array<float *> &floats) = 0;
68 
69  /// Find a method by name, and return the shader and arguments
70  /// associated with it. If the method does not exist, return 0.
71  /// The method @b must set @c args.
72  virtual VEX_AssemblePtr getMethod(const char *name,
74  virtual VEX_AssemblePtr getMethod(const char *name,
76 
77 private:
78 };
79 
81 
82 #endif
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glcorearb.h:2540
const UT_StringHolder & getName() const
Definition: VEX_RefObject.h:34
ImageBuf OIIO_API flatten(const ImageBuf &src, ROI roi={}, int nthreads=0)
#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:36
#define UT_NON_COPYABLE(CLASS)
Define deleted copy constructor and assignment operator inside a class.
GLuint const GLchar * name
Definition: glcorearb.h:786
**If you just want to fire and args
Definition: thread.h:609
UT_IntrusivePtr< VEX_RefObject > VEX_ObjectHandle
Definition: VEX_RefObject.h:80