00001 /* 00002 * PROPRIETARY INFORMATION. This software is proprietary to 00003 * Side Effects Software Inc., and is not to be reproduced, 00004 * transmitted, or disclosed in any way without written permission. 00005 * 00006 * Produced by: 00007 * Side Effects Software Inc 00008 * 477 Richmond Street West 00009 * Toronto, Ontario 00010 * Canada M5V 3E7 00011 * 416-504-9876 00012 * 00013 * NAME: POP_BlindData.h ( POP Library, C++) 00014 * 00015 * COMMENTS: This is a class which allows POPs to add "blind" data to the 00016 * context. 00017 * 00018 * Since POPs may be cooked in different contexts (i.e. the POP network 00019 * may be referenced by multiple SOPs, or the viewer etc.), state 00020 * dependent information should not be stored with the POP_Node sub-class. 00021 * Instead, the POP_Node should add blind data to the context. This can 00022 * be used to store state information from cook-to-cook. 00023 * 00024 * The POP_Node will typically have code like: 00025 * 00026 * class MyBlindData : public POP_BlindData {...}; 00027 * 00028 * MyPop::cook(OP_Context &context) { 00029 * POP_ContextData *cdata = (POP_ContextData *)context.getData(); 00030 * MyBlindData *mydata; 00031 * 00032 * mydata = cdata->getBlindData(this); 00033 * if (!mydata) 00034 * { 00035 * mydata = new MyBlindData(*this); 00036 * cdata->addBlindData(mydata); 00037 * } 00038 * 00039 * Since contexts are copied on occasion, it is important to implement the 00040 * "duplicate" method. The copy of the context data is typically stored 00041 * as a "cache" version of the POP context. For example, when the calling 00042 * SOP says to cache N frames, there will be up to N context data's lying 00043 * around. Each one built for a different OP_Context. 00044 * 00045 * NOTE: This class is really only needed if the custom POP needs to keep 00046 * around state information from frame to frame. Most data can be safely 00047 * stored with the POP. 00048 * 00049 * When the simulation gets reset, all blind data is destroyed, and should 00050 * be re-created on the next cook of the OP which needs it. 00051 */ 00052 00053 #ifndef __POP_BlindData__ 00054 #define __POP_BlindData__ 00055 00056 #include "POP_API.h" 00057 class POP_Node; 00058 class POP_ContextData; 00059 00060 class POP_API POP_BlindData { 00061 public: 00062 POP_BlindData(POP_Node *node); 00063 virtual ~POP_BlindData(); 00064 00065 // 00066 // The duplicate() method should create a new copy of the blind data. 00067 // Please see above. 00068 // When the copy of the data is made, the source's owner can be used in the 00069 // constructor. 00070 // The src POP_ContextData is the source context from which this blind data 00071 // is being duplicated from. 00072 virtual POP_BlindData *duplicate(const POP_ContextData *src) = 0; 00073 00074 // 00075 // When the simulation get's reset, the following method is called. If the 00076 // method returns 1, then the blind data will be deleted and reset inside 00077 // the context. This can be used to detect a reset without having to 00078 // reconstruct expensive data structures on the next cook. 00079 // The default behaviour is to return 1 (i.e. delete itself on reset of 00080 // the simulation). 00081 virtual int resetSimulation(); 00082 00083 // 00084 // This is the owner of the blind data (i.e. the POP_Node which was passed 00085 // in the constructor. 00086 const POP_Node *getOwner() const; 00087 POP_Node *getOwner(); 00088 protected: 00089 00090 private: 00091 int myOwnerId; 00092 }; 00093 00094 #endif
1.5.9