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

MessageHelper.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 __MESSAGEHELPER_H__
00012 #define __MESSAGEHELPER_H__
00013 #include "RNPlatform/Inc/DLLExportAPI.h"
00014 #include <string>
00015 
00016 namespace RNReplicaNet
00017 {
00018 
00019 #define MESSAGEHELPER_ADDVARIABLE(x)    \
00020 AddVariable(&(x),sizeof(x));
00021 
00022 #define MESSAGEHELPER_GETVARIABLE(x)    \
00023 GetVariable(&(x),sizeof(x));
00024 
00025 #define MESSAGEHELPER_ADDVARIABLEp(y,x) \
00026 y.AddVariable(&(x),sizeof(x));
00027 
00028 #define MESSAGEHELPER_GETVARIABLEp(y,x) \
00029 y.GetVariable(&(x),sizeof(x));
00030 
00035 class REPNETEXPORTAPI MessageHelper
00036 {
00037 public:
00041     MessageHelper();
00042 
00046     virtual ~MessageHelper();
00047 
00052     void SetBuffer(void *const buffer);
00053 
00059     void AddVariable(const void *variable,const int size);
00060 
00066     void AddData(const void *data,const int size);
00067 
00073     void GetVariable(void *const variable,const int size);
00074 
00080     void GetData(void *const data,const int size);
00081 
00086     int GetSize(void);
00087 
00092     void SetSize(const int size);
00093 
00098     void AddInteger(const int value);
00099 
00104     void AddFloat(const float value);
00105 
00110     int GetInteger(void);
00111 
00117     float GetFloat(void);
00118 
00122     static std::string DumpAsHex(const void *data,const int size);
00123 
00124 private:
00125     unsigned char *mFirstPtr;           
00126     unsigned char *mBufferPtr;          
00127 };
00128 
00129 } // namespace RNReplicaNet
00130 
00131 #endif

Generated on Sun Oct 30 01:12:31 2005 for Platform by  doxygen 1.4.1