HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OP_Caller.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: OP_Caller.h ( OP Library, C++)
7  *
8  * COMMENTS: Sub-class of the UT_OpCaller which is used to handle op
9  * references.
10  */
11 
12 #ifndef __OP_Caller__
13 #define __OP_Caller__
14 
15 #include "OP_API.h"
16 #include <UT/UT_OpCaller.h>
17 #include <UT/UT_ConcurrentVector.h>
18 #include <DEP/DEP_ContextOptions.h>
19 
20 class OP_Node;
21 class DEP_MicroNode;
22 
24 {
25 public:
26  OP_Caller(OP_Node *node,
27  const DEP_ContextOptionsStack *context_options_stack,
28  DEP_ContextOptionsReadHandle context_options);
29  OP_Caller(OP_Node *node, DEP_MicroNode *micronode,
30  const DEP_ContextOptionsStack *context_options_stack,
31  DEP_ContextOptionsReadHandle context_options);
32  ~OP_Caller() override;
33 
34  /// @{
35  /// Get the calling node (i.e. the node being cooked)
36  /// This CAN be nullptr, for example if an explicit micronode is
37  /// the dependency, as can happen in compiled SOP networks.
38  int getOpId() override;
40  { return myNode; }
41  /// @}
42 
43  /// Return the options associated with the calling context.
45  { return myContextOptionsStack; }
46 
47  /// Return the options associated with the calling context.
49  { return myContextOptions; }
50 
51  /// Tell the calling node that they refer to the data for the other op
52  /// If the @c callee is not NULL, it's doneWithOp() method will be called
53  /// after the caller is finished with the node.
54  void referenceOtherOp(
55  int opid,
56  UT_OpCallee *cache,
57  bool flaginterest,
58  bool spareinterest = false) override;
59 
60  /// Reference a specific parameter
62  int opid, int pi, int vi, bool add_timedep=true) override;
63 
64  /// Clear all references (notifying callee's about completion
65  void clearReferences();
66 
67  /// Add operator dependencies -- the user should ensure that this is called
68  /// in a thread-safe fashion.
69  /// @note This is called automatically from the destructor.
70  void addDependencies();
71 
72  /// Flag the caller to ignore time dependencies in addDependencies.
73  /// Used when cooking a channel time range in VEXCHOP
74  bool ignoreTimeDep() const;
75  void setIgnoreTimeDep();
76 
77 protected:
78 
80  {
81  public:
82  NodeInterest(int id, UT_OpCallee *cache, bool flag = false, bool spare=false)
83  : myOpId(id)
84  , myCallee(cache)
85  , myFlagInterest(flag)
86  , mySpareInterest(spare)
87  {
88  }
90  : myOpId(src.myOpId)
91  , myCallee(src.myCallee)
92  , myFlagInterest(src.myFlagInterest)
93  , mySpareInterest(src.mySpareInterest)
94  {
95  }
97  {
98  myOpId = src.myOpId;
99  myCallee = src.myCallee;
100  myFlagInterest = src.myFlagInterest;
101  mySpareInterest = src.mySpareInterest;
102  return *this;
103  }
104  bool operator==(const NodeInterest &src) const
105  {
106  return myOpId == src.myOpId &&
107  myCallee == src.myCallee &&
108  myFlagInterest == src.myFlagInterest &&
109  mySpareInterest == src.mySpareInterest;
110  }
111 
112  int getOpId() const { return myOpId; }
113  UT_OpCallee *getCallee() const { return myCallee; }
114  bool getFlagInterest() const{ return myFlagInterest; }
115  bool getSpareInterest() const{ return mySpareInterest; }
116 
117  private:
118  int myOpId;
119  bool myFlagInterest;
120  bool mySpareInterest;
121  UT_OpCallee *myCallee;
122  };
123 
124  typedef UT_ConcurrentVector<NodeInterest> ListType;
125 
132 };
133 
134 #endif
DEP_ContextOptionsReadHandle myContextOptions
Definition: OP_Caller.h:130
bool getFlagInterest() const
Definition: OP_Caller.h:114
UT_OpCallee * getCallee() const
Definition: OP_Caller.h:113
NodeInterest(const NodeInterest &src)
Definition: OP_Caller.h:89
int getOpId() const
Definition: OP_Caller.h:112
UT_ConcurrentVector< NodeInterest > ListType
Definition: OP_Caller.h:124
NodeInterest & operator=(const NodeInterest &src)
Definition: OP_Caller.h:96
const DEP_ContextOptionsStack * getContextOptionsStack() const
Return the options associated with the calling context.
Definition: OP_Caller.h:44
bool myIgnoreTimeDep
Definition: OP_Caller.h:131
OP_Node * myNode
Definition: OP_Caller.h:127
virtual void referenceOtherParameter(int opid, int pi, int vi, bool add_timedep=true)=0
Reference a specific parameter.
virtual int getOpId()=0
Callee's might want to find out the unique id of the caller. The /.
virtual void referenceOtherOp(int opid, UT_OpCallee *cache, bool flaginterest, bool spareinterest=false)=0
NodeInterest(int id, UT_OpCallee *cache, bool flag=false, bool spare=false)
Definition: OP_Caller.h:82
const DEP_ContextOptionsStack * myContextOptionsStack
Definition: OP_Caller.h:129
bool operator==(const NodeInterest &src) const
Definition: OP_Caller.h:104
#define OP_API
Definition: OP_API.h:10
DEP_ContextOptionsReadHandle getContextOptions() const
Return the options associated with the calling context.
Definition: OP_Caller.h:48
constexpr T pi()
Pi constant taken from Boost to match old behaviour.
Definition: Math.h:119
bool getSpareInterest() const
Definition: OP_Caller.h:115
DEP_MicroNode * myMicroNode
Definition: OP_Caller.h:128
ListType myInterests
Definition: OP_Caller.h:126
OP_Node * getNode()
Definition: OP_Caller.h:39
GLenum src
Definition: glcorearb.h:1793