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