00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef __TAKE_Data__
00028 #define __TAKE_Data__
00029
00030 #include "TAKE_API.h"
00031 #include "TAKE_Hash.h"
00032
00033 class UT_String;
00034 class UT_WorkBuffer;
00035
00036 #define TAKE_HIGH_PRIORITY 10 // Data is applied before other data
00037 #define TAKE_NORMAL_PRIORITY 100
00038 #define TAKE_LOW_PRIORITY 1000 // Data is applied last
00039
00040 class TAKE_API TAKE_Data {
00041 public:
00042 TAKE_Data(const TAKE_Hash &hash, int priority) :
00043 myHash(hash), myRefCount(0), myPriority(priority) { }
00044 virtual ~TAKE_Data();
00045
00046
00047 virtual TAKE_Data *duplicate() const = 0;
00048
00049
00050
00051 virtual bool canDuplicateForNode(int op_id) const = 0;
00052
00053 virtual TAKE_Data *duplicateForNode(int op_id) const = 0;
00054
00055
00056 virtual void storeCurrent() = 0;
00057
00058 virtual void applyData() = 0;
00059
00060 virtual void getOpIdString(UT_String &str) = 0;
00061
00062
00063 virtual void markActive() = 0;
00064 virtual void markInactive() = 0;
00065
00066
00067 virtual void generateIncludeCommand(UT_WorkBuffer &) = 0;
00068 virtual void generateCommand(UT_WorkBuffer &) = 0;
00069
00070
00071 virtual void getDescription(UT_WorkBuffer &, int brief=0) = 0;
00072
00073
00074 virtual int64 getMemoryUsage() const = 0;
00075
00076
00077
00078
00079 virtual bool canSaveInMasterTake() const = 0;
00080
00081 virtual int save(ostream &os, int binary) const = 0;
00082 virtual bool load(UT_IStream &is) = 0;
00083
00084 const TAKE_Hash &getHash() const { return myHash; }
00085
00086 void bumpRefCount(int dir) { myRefCount += dir; }
00087 int getRefCount() const { return myRefCount; }
00088
00089 void setPriority(int p) { myPriority = p; }
00090 int getPriority() const { return myPriority; }
00091
00092 private:
00093
00094 TAKE_Hash myHash;
00095 int myRefCount;
00096 int myPriority;
00097 };
00098
00099 #endif