Main Page | Class Hierarchy | Class List | Directories | File List | Class Members

DataBlock_NData.h

00001 /* START_LICENSE_HEADER
00002 
00003 Copyright (C) 2000 Martin Piper, original design and program code
00004 Copyright (C) 2001-2005 Replica Software
00005 
00006 This program file is copyright (C) Replica Software and can only be used under license.
00007 For more information visit: http://www.replicanet.com/
00008 Or email: info@replicanet.com
00009 
00010 END_LICENSE_HEADER */
00011 #ifndef __DATABLOCK_NDATA_H__
00012 #define __DATABLOCK_NDATA_H__
00013 #include "RNPlatform/Inc/DLLExportAPI.h"
00014 
00015 #include "RNReplicaNet/Inc/DataBlock.h"
00016 #include <list>
00017 
00018 namespace RNReplicaNet
00019 {
00020 
00025 class REPLICANETDLL_API DataBlock_NData : public DataBlock
00026 {
00027 public:
00031     DataBlock_NData();
00032 
00036     virtual ~DataBlock_NData();
00037 
00038     virtual void Poll(DataBlockReason *reason);
00039 
00040     virtual void ParseMessage(MessageHelper *message);
00041 
00048     static DataBlock_NData *Register(void *const data,const int size);
00049 
00055     void RegisterInClassPointer(void *const data,const int size)
00056     {
00057         mData = data;
00058         mSize = size;
00059     }
00060 
00066     void SetDefaultData(const void *data);
00067 
00068     bool IsAttached(void *data);
00069 
00070     void SetEndianTest(const bool test = true);
00071 
00072     bool GetEndianTest(void) const;
00073 
00074 private:
00075     void *mData;
00076     int mSize;
00077 
00078     struct SessionBlock_NData
00079     {
00080         SessionBlock_NData(int sessid,int datasize);
00081 
00082         virtual ~SessionBlock_NData();
00083 
00084         int mSessionID;
00085         void *mTestData;
00086 
00087         // Forced updates
00088         // This works off local time, not network time
00089         float mLastUpdateSentLocalTime;
00090         int mNumForcedUpdates;
00091     };
00092 
00093     std::list<SessionBlock_NData *> mPerSessionData;
00094 
00095     void *mDefaultData;
00096     bool mDisableEndian;
00097 };
00098 
00099 } // namespace RNReplicaNet
00100 
00101 /* _RO_DO_REGISTERBLOCK_NDATA_VAR macro starts here */
00102 #define _RO_DO_REGISTERBLOCK_NDATA_VAR(x)   \
00103     {\
00104         RNReplicaNet::DataBlock_NData *datablock = 0;   \
00105         datablock = RNReplicaNet::DataBlock_NData::Register(&(basepoint->x),sizeof(basepoint->x));  \
00106         _RO_DO_SETDATABLOCKVARIABLENAME(x);
00107 /* _RO_DO_REGISTERBLOCK_NDATA_VAR macro ends here */
00108 
00109 /* _RO_DO_REGISTERBLOCK_NDATA_VARAT macro starts here */
00110 #define _RO_DO_REGISTERBLOCK_NDATA_VARAT(x) \
00111     {\
00112         RNReplicaNet::DataBlock_NData *datablock = 0;   \
00113         datablock = RNReplicaNet::DataBlock_NData::Register((basepoint->x),sizeof(basepoint->x));   \
00114         _RO_DO_SETDATABLOCKVARIABLENAME(x);
00115 /* _RO_DO_REGISTERBLOCK_NDATA_VARAT macro ends here */
00116 
00117 /* _RO_DO_REGISTERBLOCK_NDATA_DISABLEENDIANTEST macro starts here */
00118 #define _RO_DO_REGISTERBLOCK_NDATA_DISABLEENDIANTEST()  \
00119         datablock->SetEndianTest(false);
00120 /* _RO_DO_REGISTERBLOCK_NDATA_DISABLEENDIANTEST macro ends here */
00121 
00122 
00123 #endif

Generated on Sun Oct 30 01:11:54 2005 for ReplicaNet by  doxygen 1.4.1