HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
POP_BlindData.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: POP_BlindData.h ( POP Library, C++)
7  *
8  * COMMENTS: This is a class which allows POPs to add "blind" data to the
9  * context.
10  *
11  * Since POPs may be cooked in different contexts (i.e. the POP network
12  * may be referenced by multiple SOPs, or the viewer etc.), state
13  * dependent information should not be stored with the POP_Node sub-class.
14  * Instead, the POP_Node should add blind data to the context. This can
15  * be used to store state information from cook-to-cook.
16  *
17  * The POP_Node will typically have code like:
18  *
19  * class MyBlindData : public POP_BlindData {...};
20  *
21  * MyPop::cook(OP_Context &context) {
22  * POP_ContextData *cdata = (POP_ContextData *)context.getData();
23  * MyBlindData *mydata;
24  *
25  * mydata = cdata->getBlindData(this);
26  * if (!mydata)
27  * {
28  * mydata = new MyBlindData(*this);
29  * cdata->addBlindData(mydata);
30  * }
31  *
32  * Since contexts are copied on occasion, it is important to implement the
33  * "duplicate" method. The copy of the context data is typically stored
34  * as a "cache" version of the POP context. For example, when the calling
35  * SOP says to cache N frames, there will be up to N context data's lying
36  * around. Each one built for a different OP_Context.
37  *
38  * NOTE: This class is really only needed if the custom POP needs to keep
39  * around state information from frame to frame. Most data can be safely
40  * stored with the POP.
41  *
42  * When the simulation gets reset, all blind data is destroyed, and should
43  * be re-created on the next cook of the OP which needs it.
44  */
45 
46 #ifndef __POP_BlindData__
47 #define __POP_BlindData__
48 
49 #include "POP_API.h"
50 class POP_Node;
51 class POP_ContextData;
52 
54 public:
55  POP_BlindData(POP_Node *node);
56  virtual ~POP_BlindData();
57 
58  //
59  // The duplicate() method should create a new copy of the blind data.
60  // Please see above.
61  // When the copy of the data is made, the source's owner can be used in the
62  // constructor.
63  // The src POP_ContextData is the source context from which this blind data
64  // is being duplicated from.
65  virtual POP_BlindData *duplicate(const POP_ContextData *src) = 0;
66 
67  //
68  // When the simulation get's reset, the following method is called. If the
69  // method returns 1, then the blind data will be deleted and reset inside
70  // the context. This can be used to detect a reset without having to
71  // reconstruct expensive data structures on the next cook.
72  // The default behaviour is to return 1 (i.e. delete itself on reset of
73  // the simulation).
74  virtual int resetSimulation();
75 
76  //
77  // This is the owner of the blind data (i.e. the POP_Node which was passed
78  // in the constructor.
79  const POP_Node *getOwner() const;
80  POP_Node *getOwner();
81 protected:
82 
83 private:
84  int myOwnerId;
85 };
86 
87 #endif
#define POP_API
Definition: POP_API.h:10
GLenum src
Definition: glcorearb.h:1792