00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __GZ_DYN_UPDATE_INTERFACE_H__
00022 #define __GZ_DYN_UPDATE_INTERFACE_H__
00023
00024 #include "gzDynBase.h"
00025
00026 enum gzDynUpdateMode
00027 {
00028 GZ_DUM_FULL,
00029 GZ_DUM_PARTIAL,
00030 GZ_DUM_NONE
00031 };
00032
00033 struct gzDynUpdateInfo
00034 {
00035 gzDouble time;
00036 gzDouble eventTime;
00037 gzGUID objectID;
00038 gzDistEvent *event;
00039 };
00040
00041 class GZ_DYN_EXPORT gzDynEventSort
00042 {
00043 public:
00044
00045 gzDynEventSort(const gzDouble &_time=0.0 , const gzULong &_typeIndex=0 , const gzULong &_eventIndex=0):time(_time),typeIndex(_typeIndex),eventIndex(_eventIndex){}
00046
00047 gzBool operator !=(const gzDynEventSort &right) const
00048 {
00049 if(time!=right.time)
00050 return TRUE;
00051
00052 if(typeIndex!=right.typeIndex)
00053 return TRUE;
00054
00055 if(eventIndex!=right.eventIndex)
00056 return TRUE;
00057
00058 return FALSE;
00059 }
00060
00061 gzBool operator ==(const gzDynEventSort &right) const
00062 {
00063 return !operator!=(right);
00064 }
00065
00066 gzBool operator <(const gzDynEventSort &right) const
00067 {
00068 if(time<right.time)
00069 return TRUE;
00070
00071 if(time>right.time)
00072 return FALSE;
00073
00074 if(typeIndex<right.typeIndex)
00075 return TRUE;
00076
00077 if(typeIndex>right.typeIndex)
00078 return FALSE;
00079
00080 if(eventIndex<right.eventIndex)
00081 return TRUE;
00082
00083 return FALSE;
00084 }
00085
00086 gzBool operator >(const gzDynEventSort &right) const
00087 {
00088 if(time>right.time)
00089 return TRUE;
00090
00091 if(time<right.time)
00092 return FALSE;
00093
00094 if(typeIndex>right.typeIndex)
00095 return TRUE;
00096
00097 if(typeIndex<right.typeIndex)
00098 return FALSE;
00099
00100 if(eventIndex>right.eventIndex)
00101 return TRUE;
00102
00103 return FALSE;
00104 }
00105
00106 gzDouble time;
00107 gzULong typeIndex;
00108 gzULong eventIndex;
00109 };
00110
00111
00112 class gzDynUpdateInterface
00113 {
00114 public:
00115
00116
00117
00118 GZ_DYN_EXPORT virtual gzDistObject *getObject(const gzGUID &objectID){ return NULL; }
00119
00120 GZ_DYN_EXPORT virtual gzVoid setUpObject(const gzGUID &objectID,gzDistObject *object){}
00121
00122
00123
00124 GZ_DYN_EXPORT virtual gzDynUpdateMode processEventAttributes( const gzDynUpdateInfo &info ){ return GZ_DUM_FULL; }
00125
00126 GZ_DYN_EXPORT virtual gzBool processEventAttribute(const gzDynUpdateInfo &info , const gzDistAttribute &attribute){ return TRUE; }
00127
00128 GZ_DYN_EXPORT virtual gzDynamicType updateAttribute(const gzDynUpdateInfo &info , const gzString &name , const gzDynamicType &newValue, const gzDynamicType &oldValue , const gzDouble &oldTime , gzDouble &updateTime){ updateTime=info.eventTime; return newValue; }
00129
00130 GZ_DYN_EXPORT virtual gzVoid updateObject(const gzDynUpdateInfo &info , gzDistTransactionPtr &transaction , const gzDistObjectPtr &object)=0;
00131
00132 GZ_DYN_EXPORT virtual gzDynamicType requestAttributeStartValue(const gzDynUpdateInfo &info , const gzString &name , const gzDynamicType &oldValue , gzDouble & attributeTime){ attributeTime=0.0; return 0.0; }
00133
00134
00135 GZ_DYN_EXPORT virtual gzVoid onNextEvent(const gzDouble ¤tEvenTime,const gzDouble &nextEventTime , gzDistEvent *event , gzBool changedEvent , gzGUID &objectID , gzDistObject *object , gzDataSortIterator<gzRefPointer<gzDistEvent>,gzDynEventSort> &iterator ){}
00136
00137
00138 GZ_DYN_EXPORT virtual gzVoid processEvent(const gzDistObjectPtr &object , const gzDynUpdateInfo &info ){}
00139 };
00140
00141 #endif //__GZ_DYN_UPDATE_INTERFACE_H__