HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_OpCaller.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: UT_OpCaller.h ( UT Library, C++)
7  *
8  */
9 
10 #ifndef __UT_OpCaller__
11 #define __UT_OpCaller__
12 
13 #include "UT_API.h"
14 #include "UT_Array.h"
15 #include "UT_NonCopyable.h"
16 
17 class UT_OpCallee;
18 
19 /// General documentation for the UT_OpCaller class.
20 ///
21 /// In some cases during the cook of an OP Node, calls will be made into low
22 /// level libraries. These libraries may have callback mechanisms to reference
23 /// data from other existing OPs, but without any dependencies on OPs
24 /// themselves. For example, in resolving the "op:some-op-path" paths, the
25 /// low level libraries don't actually know about OPs, but rely on callbacks
26 /// to perform the evaluation.
27 ///
28 /// However, the caller OP (the OP cooking) isn't notified of these additional
29 /// dependencies and so doesn't end up cooking properly. This pair of classes
30 /// provides a mechanism for implementing the appropriate dependencies.
31 /// Prior to cooking, the OP can create a UT_Caller class which acts as a sink
32 /// for all the OP references which get made. At the conclusion of the cook,
33 /// the OP can then call back to all the classes which made the references
34 /// (the OP_Callee classes) and notify them that the data they built is no
35 /// longer required.
36 ///
37 /// This class is primarily used by VEX at the current time.
38 
40 {
41 public:
42  /// This class provides a virtual interface to OP_Nodes so that
43  /// they can query the op-node which is being evaluated.
44  UT_OpCaller();
45  virtual ~UT_OpCaller();
46 
48 
49  /// Callee's might want to find out the unique id of the caller. The /
50  //getOpId() method should provide the correct id for the cooking OP
51  virtual int getOpId() = 0;
52 
53  /// The referenceOtherOp() method is called when a callee magically
54  /// references another operator. This might happen when referencing a
55  /// file using the "op:soppath" syntax.
56  /// At the conclusion of cooking, this cache should be notified that the
57  /// OP is done with the data.
58  virtual void referenceOtherOp(int opid, UT_OpCallee *cache,
59  bool flaginterest, bool spareinterest=false) = 0;
60 
61  /// Reference a specific parameter
62  virtual void referenceOtherParameter(int opid, int pi, int vi, bool add_timedep=true) = 0;
63 
64  /// Registers an interest of the callee to be notified by calling
65  /// its virtual done() method, when the caller is done with all VEX data.
66  void notifyCalleeWhenDone(UT_OpCallee *cache);
67 
68  /// Checks if this caller will notify the given callee when done with VEX.
69  bool willNotifyCalleeWhenDone(UT_OpCallee *cache);
70 
71 protected:
72  /// Notify the callees that the caller object is done with VEX.
73  void notifyCalleesThatDone();
74 
75 private:
76  UT_Array<UT_OpCallee*> myCallees;
77 };
78 
80 {
81 public:
82  /// The UT_OpCallee class is used as a general mechanism to get callbacks
83  /// when a reference to an OP is no longer needed.
84  UT_OpCallee();
85  virtual ~UT_OpCallee();
86 
88 
89  /// This method should be called by the UT_OpCaller when the data is no
90  /// longer required.
91  virtual void doneWithOp(int opid) = 0;
92 
93  /// This method is called by the UT_OpCaller's destructor to notify
94  /// that it is done with all VEX data and ops.
95  virtual void done(UT_OpCaller *caller);
96 };
97 
98 #endif
99 
**And then you can **find out if it s done
Definition: thread.h:622
#define UT_API
Definition: UT_API.h:14
#define UT_NON_COPYABLE(CLASS)
Define deleted copy constructor and assignment operator inside a class.
__hostdev__ constexpr T pi()
Pi constant taken from Boost to match old behaviour.
Definition: NanoVDB.h:976