HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PDG_Event.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  * COMMENTS:
7  */
8 
9 #ifndef __PDG_EVENT_H__
10 #define __PDG_EVENT_H__
11 
12 #include "PDG_API.h"
13 
14 #include "PDG_Types.h"
15 #include "PDG_WorkItem.h"
16 #include "PDG_WorkItemStats.h"
17 
18 #include <UT/UT_StringHolder.h>
19 
20 class PDG_GraphContext;
21 class PDG_Node;
22 class PDG_ServiceManager;
23 class PDG_Scheduler;
24 
26 {
27 public:
28  PDG_Event();
29  PDG_Event(const PDG_Event& event);
30  PDG_Event& operator = (const PDG_Event& event);
31  PDG_Event(PDG_EventType type,
32  PDG_GraphContext* context,
33  const PDG_Node* node = nullptr,
34  const PDG_Node* node2 = nullptr,
35  const PDG_Scheduler* scheduler = nullptr,
40  const UT_StringHolder& message = "",
42 
43  PDG_Event(PDG_EventType type,
44  PDG_GraphContext *context,
45  const PDG_Node *node,
46  PDG_WorkItemID work_item_id,
47  const UT_StringHolder &attrName = "");
48 
49  PDG_Event(PDG_EventType type,
50  PDG_GraphContext* context,
51  const PDG_Node* node,
52  const UT_StringHolder& oldName,
53  const UT_StringHolder& newName);
54 
55  PDG_Event(PDG_EventType type,
56  PDG_ServiceManager* sm);
57 
58  PDG_Event(PDG_EventType type,
60  const UT_StringHolder& serviceName);
61 
62  PDG_Event(PDG_EventType type,
64  const UT_StringHolder& serviceName,
65  const UT_StringHolder& serviceClient);
66 
67  PDG_Event(PDG_EventType type, const PDG_WorkItemIDArray& workItemArray);
68 
69  // Helpers for creating events, I'd like it to be replaced by children
70  // classes constructors in the future
71  // Not a pleasant sight here, but it makes the code actually emitting
72  // events much more readable
73  static PDG_Event NodeCreate(
74  PDG_GraphContext *context,
75  const PDG_Node *node);
76  static PDG_Event NodeRemove(
77  PDG_GraphContext *context,
78  const PDG_Node *node);
79 
80  static PDG_Event NodeConnect(
81  PDG_GraphContext *context,
82  const PDG_Node* input,
83  const PDG_Node* output);
84  static PDG_Event NodeDisconnect(
85  PDG_GraphContext *context,
86  const PDG_Node* input,
87  const PDG_Node* output);
88  static PDG_Event NodeFirstCook(
89  PDG_GraphContext *context,
90  const PDG_Node* node);
91 
92  static PDG_Event NodeGenerated(
93  PDG_GraphContext *context,
94  const PDG_Node *node);
95  static PDG_Event NodeCooked(
96  PDG_GraphContext *context,
97  const PDG_Node *node);
98 
99  static PDG_Event DirtyStart(
100  PDG_GraphContext *context,
101  const PDG_Node *node);
102  static PDG_Event DirtyStop(
103  PDG_GraphContext *context,
104  const PDG_Node *node);
105  static PDG_Event DirtyAll(
106  PDG_GraphContext *context,
107  const PDG_Node *node = nullptr);
108  static PDG_Event NodeClear(
109  PDG_GraphContext *context,
110  const PDG_Node *node);
111 
112  static PDG_Event CookError(
113  PDG_GraphContext *context,
114  const PDG_Node *node,
115  const UT_StringHolder &message);
116  static PDG_Event CookWarning(
117  PDG_GraphContext *context,
118  const PDG_Node *node,
119  const UT_StringHolder &message);
120 
121  static PDG_Event WorkItemRemove(
122  PDG_GraphContext *context,
123  const PDG_Node *node,
124  PDG_WorkItemID work_item_id,
125  PDG_WorkItemState currentState);
126 
127  static PDG_Event CookStart(
128  PDG_GraphContext *context,
129  const PDG_Node *node);
130  static PDG_Event CookComplete(
131  PDG_GraphContext *context,
132  const PDG_Node *node);
133 
134  static PDG_Event CookError(
135  PDG_GraphContext *context,
136  const PDG_Scheduler *scheduler,
137  const UT_StringHolder &message);
138  static PDG_Event CookWarning(
139  PDG_GraphContext *context,
140  const PDG_Scheduler *scheduler,
141  const UT_StringHolder &message);
142 
143  static PDG_Event WorkItemAddDep(
144  PDG_GraphContext *context,
145  const PDG_Node *node,
146  PDG_WorkItemID id,
147  PDG_WorkItemID depId);
148  static PDG_Event WorkItemRemoveDep(
149  PDG_GraphContext *context,
150  const PDG_Node *node,
151  PDG_WorkItemID id,
152  PDG_WorkItemID depId);
153 
154  static PDG_Event WorkItemCookPercentUpdate(
155  PDG_GraphContext *context,
156  const PDG_Node *node,
157  PDG_WorkItemID id);
158 
159  static PDG_Event WorkItemStateChange(
160  PDG_GraphContext *context,
161  const PDG_Node *node,
162  PDG_WorkItemID id,
163  PDG_WorkItemState old_state,
164  PDG_WorkItemState new_state);
165  static PDG_Event WorkItemAdd(
166  PDG_GraphContext *context,
167  const PDG_Node *node,
168  PDG_WorkItemID id);
169 
170  static PDG_Event UISelect(
171  PDG_GraphContext *context,
172  const PDG_Node *node,
173  PDG_WorkItemID id);
174 
175  static PDG_Event SetIntData(
176  PDG_GraphContext *context,
177  const PDG_Node *node,
178  PDG_WorkItemID work_item_id,
179  const UT_StringHolder &attrName);
180  static PDG_Event SetFloatData(
181  PDG_GraphContext *context,
182  const PDG_Node *node,
183  PDG_WorkItemID work_item_id,
184  const UT_StringHolder &attrName);
185  static PDG_Event SetStringData(
186  PDG_GraphContext *context,
187  const PDG_Node *node,
188  PDG_WorkItemID work_item_id,
189  const UT_StringHolder &attrName);
190 
191  static PDG_Event MergeData(
192  PDG_GraphContext *context,
193  const PDG_Node *node,
194  PDG_WorkItemID work_item_id);
195  static PDG_Event OutputFiles(
196  PDG_GraphContext *context,
197  const PDG_Node *node,
198  PDG_WorkItemID work_item_id);
199 
200  static PDG_Event WorkItemPriority(
201  PDG_GraphContext *context,
202  const PDG_Node *node,
203  PDG_WorkItemID work_item_id);
204 
205  static PDG_Event NodeProgressUpdate(
206  PDG_GraphContext* context,
207  const PDG_Node* node);
208 
209  static PDG_Event NodeRename(
210  PDG_GraphContext *context,
211  const PDG_Node *node,
212  const UT_StringHolder &oldName,
213  const UT_StringHolder &newName);
214 
215  static PDG_Event SchedulerAdded(
216  PDG_GraphContext *context,
217  const PDG_Scheduler *scheduler);
218  static PDG_Event SchedulerRemoved(
219  PDG_GraphContext *context,
220  const PDG_Scheduler *scheduler);
221  static PDG_Event SetScheduler(
222  PDG_GraphContext *context,
223  const PDG_Node *node,
224  const PDG_Scheduler *scheduler);
225 
226  static PDG_Event ServiceManagerAll(PDG_ServiceManager *sm);
227  static PDG_Event ServiceStartBegin(
228  PDG_ServiceManager *sm,
229  const UT_StringHolder& service_name);
230  static PDG_Event ServiceStartEnd(
231  PDG_ServiceManager *sm,
232  const UT_StringHolder& service_name);
233  static PDG_Event ServiceClientStarted(
234  PDG_ServiceManager *sm,
235  const UT_StringHolder& service_name,
236  const UT_StringHolder& client_name);
237  static PDG_Event ServiceClientChanged(
238  PDG_ServiceManager *sm,
239  const UT_StringHolder& service_name,
240  const UT_StringHolder& client_name);
241 
242  static PDG_Event BatchWorkItemInitialized(
243  const PDG_WorkItemIDArray& workItemArray);
244 
245 public:
246  PDG_EventType type() const
247  { return myType; }
249  { return myContext; }
251  { return myServiceManager; }
252 
253  PDG_Node* node() const;
254  PDG_Node* node2() const;
255  PDG_Scheduler* scheduler() const;
256 
258  { return myWorkItemId; }
260  { return myDependencyId; }
261 
263  { return myCurrentState; }
265  { return myLastState; }
266  const UT_StringHolder& message() const
267  { return myMessage; }
268  const PDG_WorkItemStats& stats() const
269  { return myStats; }
270 
271  const UT_StringHolder& attrName() const
272  { return myAttrName; }
273 
274  const UT_StringHolder& oldName() const
275  { return myOldName; }
276  const UT_StringHolder& newName() const
277  { return myNewName; }
278 
280  { return myServiceName; }
282  { return myServiceClientName; }
283 
285  { return myWorkItemArray; }
286 
287  int nodeId() const
288  { return myNode; }
289  int node2Id() const
290  { return myNode2; }
292  { return myScheduler; }
293 
294 #if PDG_EVENT_QUEUE_DEBUG
295  UT_StringHolder toString() const;
296 #endif
297 
298 private:
299  PDG_EventType myType = PDG_EventType::PDG_EVENT_NULL;
300 
301  PDG_GraphContext* myContext = nullptr;
302  int myNode = -1;
303  int myNode2 = -1;
304  UT_StringHolder myScheduler;
305 
306  PDG_ServiceManager* myServiceManager = nullptr;
307  UT_StringHolder myServiceName;
308  UT_StringHolder myServiceClientName;
309 
310  UT_StringHolder myMessage;
311 
314 
317 
318  PDG_WorkItemStats myStats;
319 
320  UT_StringHolder myAttrName;
321 
322  UT_StringHolder myOldName;
323  UT_StringHolder myNewName;
324 
325  PDG_WorkItemIDArray myWorkItemArray;
326 };
327 
328 #endif
GLuint GLsizei const GLchar * message
Definition: glcorearb.h:2543
PDG_WorkItemID workItemId() const
Definition: PDG_Event.h:257
#define PDG_API
Definition: PDG_API.h:23
const UT_StringHolder & serviceClientName() const
Definition: PDG_Event.h:281
const PDG_WorkItemStats & stats() const
Definition: PDG_Event.h:268
const UT_StringHolder & message() const
Definition: PDG_Event.h:266
struct _cl_event * event
Definition: glcorearb.h:2961
const UT_StringHolder & attrName() const
Definition: PDG_Event.h:271
PDG_WorkItemID dependencyId() const
Definition: PDG_Event.h:259
PDG_EventType type() const
Definition: PDG_Event.h:246
const UT_StringHolder & newName() const
Definition: PDG_Event.h:276
int nodeId() const
Definition: PDG_Event.h:287
int node2Id() const
Definition: PDG_Event.h:289
PDG_ServiceManager * serviceManager() const
Definition: PDG_Event.h:250
PDG_WorkItemState
Enum of possible work item states.
Definition: PDG_Types.h:413
PDG_WorkItemState currentState() const
Definition: PDG_Event.h:262
const UT_StringHolder & serviceName() const
Definition: PDG_Event.h:279
PDG_WorkItemState lastState() const
Definition: PDG_Event.h:264
const PDG_WorkItemIDArray & workItemArray() const
Definition: PDG_Event.h:284
static constexpr PDG_WorkItemID theInvalidId
Default, invalid work item ID value.
Definition: PDG_WorkItem.h:49
exint PDG_WorkItemID
Type defs for unique work item IDs.
Definition: PDG_Types.h:48
type
Definition: core.h:1059
PDG_GraphContext * context() const
Definition: PDG_Event.h:248
const UT_StringHolder & oldName() const
Definition: PDG_Event.h:274
const UT_StringHolder & schedulerName() const
Definition: PDG_Event.h:291