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  int getOpId() override;
38  { return myNode; }
39  /// @}
40 
41  /// Return the options associated with the calling context.
43  { return myContextOptionsStack; }
44 
45  /// Return the options associated with the calling context.
47  { return myContextOptions; }
48 
49  /// Tell the calling node that they refer to the data for the other op
50  /// If the @c callee is not NULL, it's doneWithOp() method will be called
51  /// after the caller is finished with the node.
52  void referenceOtherOp(
53  int opid,
54  UT_OpCallee *cache,
55  bool flaginterest,
56  bool spareinterest = false) override;
57 
58  /// Reference a specific parameter
60  int opid, int pi, int vi) override;
61 
62  /// Clear all references (notifying callee's about completion
63  void clearReferences();
64 
65  /// Add operator dependencies -- the user should ensure that this is called
66  /// in a thread-safe fashion.
67  /// @note This is called automatically from the destructor.
68  void addDependencies();
69 
70  /// Flag the caller to ignore time dependencies in addDependencies.
71  /// Used when cooking a channel time range in VEXCHOP
72  bool ignoreTimeDep() const;
73  void setIgnoreTimeDep();
74 
75 protected:
76 
78  {
79  public:
80  NodeInterest(int id, UT_OpCallee *cache, bool flag = false, bool spare=false)
81  : myOpId(id)
82  , myCallee(cache)
83  , myFlagInterest(flag)
84  , mySpareInterest(spare)
85  {
86  }
88  : myOpId(src.myOpId)
89  , myCallee(src.myCallee)
90  , myFlagInterest(src.myFlagInterest)
91  , mySpareInterest(src.mySpareInterest)
92  {
93  }
95  {
96  myOpId = src.myOpId;
97  myCallee = src.myCallee;
98  myFlagInterest = src.myFlagInterest;
99  mySpareInterest = src.mySpareInterest;
100  return *this;
101  }
102  bool operator==(const NodeInterest &src) const
103  {
104  return myOpId == src.myOpId &&
105  myCallee == src.myCallee &&
106  myFlagInterest == src.myFlagInterest &&
107  mySpareInterest == src.mySpareInterest;
108  }
109 
110  int getOpId() const { return myOpId; }
111  UT_OpCallee *getCallee() const { return myCallee; }
112  bool getFlagInterest() const{ return myFlagInterest; }
113  bool getSpareInterest() const{ return mySpareInterest; }
114 
115  private:
116  int myOpId;
117  bool myFlagInterest;
118  bool mySpareInterest;
119  UT_OpCallee *myCallee;
120  };
121 
122  typedef UT_ConcurrentVector<NodeInterest> ListType;
123 
130 };
131 
132 #endif
DEP_ContextOptionsReadHandle myContextOptions
Definition: OP_Caller.h:128
GLenum src
Definition: glew.h:2410
bool getFlagInterest() const
Definition: OP_Caller.h:112
UT_OpCallee * getCallee() const
Definition: OP_Caller.h:111
NodeInterest(const NodeInterest &src)
Definition: OP_Caller.h:87
int getOpId() const
Definition: OP_Caller.h:110
UT_ConcurrentVector< NodeInterest > ListType
Definition: OP_Caller.h:122
NodeInterest & operator=(const NodeInterest &src)
Definition: OP_Caller.h:94
const DEP_ContextOptionsStack * getContextOptionsStack() const
Return the options associated with the calling context.
Definition: OP_Caller.h:42
bool myIgnoreTimeDep
Definition: OP_Caller.h:129
OP_Node * myNode
Definition: OP_Caller.h:125
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:80
const DEP_ContextOptionsStack * myContextOptionsStack
Definition: OP_Caller.h:127
virtual void referenceOtherParameter(int opid, int pi, int vi)=0
Reference a specific parameter.
bool operator==(const NodeInterest &src) const
Definition: OP_Caller.h:102
#define OP_API
Definition: OP_API.h:10
DEP_ContextOptionsReadHandle getContextOptions() const
Return the options associated with the calling context.
Definition: OP_Caller.h:46
constexpr T pi()
Pi constant taken from Boost to match old behaviour.
Definition: Math.h:108
bool getSpareInterest() const
Definition: OP_Caller.h:113
DEP_MicroNode * myMicroNode
Definition: OP_Caller.h:126
ListType myInterests
Definition: OP_Caller.h:124
OP_Node * getNode()
Definition: OP_Caller.h:37