00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef _ZOIDREPLICATOR_H_
00010 #define _ZOIDREPLICATOR_H_
00011
00015 #include "zoidcom.h"
00016
00017
00018 class ZCom_Node;
00019 class ZCom_Node_Private;
00020
00021
00027
00028 #define ZCOM_REPLICATOR_CALLPROCESS (1L << 0)
00029
00030 #define ZCOM_REPLICATOR_ZCOMOWNAGE (1L << 1)
00031
00032 #define ZCOM_REPLICATOR_INITIALIZED (1L << 2)
00033
00034 #define ZCOM_REPLICATOR_BASIC (1L << 3)
00035
00036 #define ZCOM_REPLICATOR_ADVANCED (1L << 4)
00037
00038 #define ZCOM_REPLICATOR_MODIFIED (1L << 5)
00039
00040 #define ZCOM_REPLICATOR_USER1 (1L << 6)
00041
00042 #define ZCOM_REPLICATOR_USER2 (1L << 7)
00043
00044
00054 class ZCOM_API ZCom_ReplicatorSetup
00055 {
00056 friend class ZCom_Node_Private;
00057 protected:
00060 zU8 m_flags;
00063 zU8 m_rules;
00065 zU8 m_intercept_id;
00071 zS16 m_mindelay;
00077 zS16 m_maxdelay;
00078
00079 public:
00081 ZCom_ReplicatorSetup(zU8 _flags, zU8 _rules);
00083 ZCom_ReplicatorSetup(zU8 _flags, zU8 _rules, zU8 _intercept_id,
00084 zS16 _min_delay, zS16 _max_delay);
00086 virtual ~ZCom_ReplicatorSetup();
00087
00094 virtual ZCom_ReplicatorSetup* Duplicate();
00095
00099 inline zU8 getInterceptID() const { return m_intercept_id; }
00100
00107 inline void setInterceptID(zU8 _id) { m_intercept_id = _id; }
00108
00112 inline zS16 getMinDelay() const { return m_mindelay; }
00113
00114
00121 inline void setMinDelay(zS16 _dly) { m_mindelay = _dly; }
00122
00126 inline zS16 getMaxDelay() const { return m_maxdelay; }
00127
00134 inline void setMaxDelay(zS16 _dly) { m_maxdelay = _dly; }
00135
00139 inline zU8 getRules() const { return m_rules; }
00140
00144 inline zU8 getFlags() const { return m_flags; }
00145
00147 void* operator new(size_t _size);
00149 void operator delete(void *_p);
00150 };
00151
00163 class ZCOM_API ZCom_Replicator
00164 {
00165 friend class ZCom_Node_Private;
00166 private:
00167 zU16 m_id;
00168 protected:
00170 zU8 m_flags;
00173 ZCom_ReplicatorSetup* m_setup;
00174 public:
00180 ZCom_Replicator(ZCom_ReplicatorSetup *_setup);
00181
00184 virtual ~ZCom_Replicator();
00185
00188 void* operator new(size_t _size);
00191 void operator delete(void *_p);
00193
00194
00195 public:
00196
00197
00198
00199
00200
00249
00250
00270 virtual void* peekData() = 0;
00271
00285 virtual void clearPeekData() = 0;
00286
00287 protected:
00299 ZCom_BitStream* getPeekStream() const;
00300
00316 void peekDataStore(void *_ptr);
00317
00321 void* peekDataRetrieve();
00323 public:
00324
00325
00326
00327
00339 virtual void Process(eZCom_NodeRole _localrole, zU32 _simulation_time_passed) = 0;
00340
00341
00342 inline bool callProcess() { return (m_flags & ZCOM_REPLICATOR_CALLPROCESS) ? true : false ; }
00343 public:
00344 ZCom_ReplicatorSetup *getSetup() const { return m_setup; }
00345 zU8 getFlags() const { return m_flags; }
00346 zU16 getId() const { return m_id; }
00347 };
00348
00349
00350
00351 #endif
00352
00353