![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /******************************************************************************* 00002 ** Copyright (c) 2006 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 *******************************************************************************/ 00005 /******************************************************************************* 00006 ** $RCSfile: bufferSerialize.h,v $ $Revision: 1.17 $ $State: Exp $ 00007 *******************************************************************************/ 00008 00011 00015 00016 #ifndef bufferSerialize_h 00017 #define bufferSerialize_h 00018 00019 #include <vlutil/vlString.h> 00020 #include <vlutil/vlMachineTypes.h> 00021 #include <matrix/vlVector.h> 00022 #include <matrix/vlTaitBryan.h> 00023 #include <vlutil/vlFilename.h> 00024 #include <vrfExtProtocol/objType.h> 00025 #include <vector> 00026 #include <list> 00027 #include <string> 00028 #include "vrfutil/vrfutilDefines.h" 00029 #include "vrfutil/rwBoolean.h" 00030 #include "vrfutil/rwInt.h" 00031 #include "vrfutil/rwObjType.h" 00032 #include "vrfutil/rwStringList.h" 00033 00034 #include <vlpi/entityIdentifier.h> 00035 #include <vlpi/appearance.h> 00036 #include <vlutil/vlInetAddr.h> 00037 00038 class DtSimInterfaceContent; 00039 00045 namespace DtBufferSerialize 00046 { 00054 00055 DT_DLL_vrfutil char *encode(const DtFilename& val, char *buffer); 00056 DT_DLL_vrfutil char *encode(const DtString& val, char *buffer); 00057 DT_DLL_vrfutil char *encode(const std::string& val, char *buffer); 00058 DT_DLL_vrfutil char *encode(const char *val, unsigned nSize, char *buffer); 00059 DT_DLL_vrfutil char *encode(const int& val, char *buffer); 00060 DT_DLL_vrfutil char *encode(const DtInt16& val, char *buffer); 00061 DT_DLL_vrfutil char *encode(const DtU8& val, char *buffer); 00062 DT_DLL_vrfutil char *encode(const DtU16& val, char *buffer); 00063 DT_DLL_vrfutil char *encode(const DtU32& val, char *buffer); 00064 DT_DLL_vrfutil char *encode(const DtU64& val, char *buffer); 00065 DT_DLL_vrfutil char *encode(const DtFloat32& val, char *buffer); 00066 DT_DLL_vrfutil char *encode(const DtFloat64& val, char *buffer); 00067 DT_DLL_vrfutil char *encode(const DtVector& val, char *buffer); 00068 DT_DLL_vrfutil char *encode(const DtTaitBryan& val, char *buffer); 00069 DT_DLL_vrfutil char *encode(const bool& val, char *buffer); 00070 DT_DLL_vrfutil char *encode(const DtObjectType& val, char *buffer); 00071 DT_DLL_vrfutil char *encode(const std::vector<char>& val, char *buffer); 00072 DT_DLL_vrfutil char *encode(const DtRwBoolean& val, char *buffer); 00073 DT_DLL_vrfutil char *encode(const DtEntityType& val, char *buffer); 00074 DT_DLL_vrfutil char *encode(const DtEntityIdentifier& val, char *buffer); 00075 DT_DLL_vrfutil char *encode(const DtSimulationAddress& val, char *buffer); 00076 DT_DLL_vrfutil char *encode(const DtAppearance& val, char *buffer); 00077 DT_DLL_vrfutil char *encode(const DtForceType& val, char *buffer); 00078 DT_DLL_vrfutil char *encode(const DtInetAddr& val, char *buffer); 00079 DT_DLL_vrfutil char *encode(const DtRwInt& val, char* buffer); 00080 DT_DLL_vrfutil char *encode(const DtRwObjectType& val, char* buffer); 00081 DT_DLL_vrfutil char *encode(const DtRwStringList& val, char* buffer); 00082 template <typename T> 00083 char* encode(const std::vector<T>& val, char* buffer); 00084 template <typename T> 00085 char* encode(const std::list<T>& val, char* buffer); 00086 template <typename T1, typename T2> 00087 char* encode(const std::map<T1, T2>& val, char* buffer); 00088 template <typename T1, typename T2> 00089 char* encode(const std::pair<T1, T2>& val, char* buffer); 00090 00091 //specialized version of decode for std::vector<bool> due to problems with c++ 00092 //standard on how vector<bool> is defined 00093 DT_DLL_vrfutil char *encode(const std::vector<bool>& val, char *buffer); 00095 00096 00104 00105 DT_DLL_vrfutil const char *decode(DtString& val, const char *buffer) ; 00106 DT_DLL_vrfutil const char *decode(std::string& val, const char *buffer) ; 00107 DT_DLL_vrfutil const char *decode(DtFilename& val, const char *buffer) ; 00108 DT_DLL_vrfutil const char *decode(int& val, const char *buffer) ; 00109 DT_DLL_vrfutil const char *decode(DtU8& val, const char *buffer) ; 00110 DT_DLL_vrfutil const char *decode(DtU16& val, const char *buffer) ; 00111 DT_DLL_vrfutil const char *decode(DtU32& val, const char *buffer) ; 00112 DT_DLL_vrfutil const char *decode(DtU64& val, const char *buffer) ; 00113 DT_DLL_vrfutil const char *decode(DtFloat32& val, const char *buffer) ; 00114 DT_DLL_vrfutil const char *decode(DtFloat64& val, const char *buffer) ; 00115 DT_DLL_vrfutil const char *decode(DtVector& val, const char *buffer) ; 00116 DT_DLL_vrfutil const char *decode(DtTaitBryan& val, const char *buffer) ; 00117 DT_DLL_vrfutil const char *decode(bool &val, const char *buffer) ; 00118 DT_DLL_vrfutil const char *decode(DtObjectType &val, const char *buffer) ; 00119 DT_DLL_vrfutil const char *decode(std::vector<char>& val, const char *buffer) ; 00120 DT_DLL_vrfutil const char *decode(DtRwBoolean &val, const char *buffer) ; 00121 DT_DLL_vrfutil const char *decode(DtEntityType& val, const char *buffer); 00122 DT_DLL_vrfutil const char *decode(DtEntityIdentifier& val, const char *buffer); 00123 DT_DLL_vrfutil const char *decode(DtSimulationAddress& val, const char *buffer); 00124 DT_DLL_vrfutil const char *decode(DtAppearance& val, const char *buffer); 00125 DT_DLL_vrfutil const char *decode(DtForceType& val, const char *buffer); 00126 DT_DLL_vrfutil const char *decode(DtInetAddr& val, const char *buffer); 00127 DT_DLL_vrfutil const char *decode(DtRwInt& val, const char *buffer); 00128 DT_DLL_vrfutil const char *decode(DtRwObjectType& val, const char *buffer); 00129 DT_DLL_vrfutil const char *decode(DtRwStringList& val, const char *buffer); 00130 template <typename T> 00131 const char *decode(std::vector<T>& val, const char *buffer); 00132 template <typename T> 00133 const char *decode(std::list<T>& val, const char *buffer); 00134 template <typename T1, typename T2> 00135 const char *decode(std::map<T1, T2>& val, const char *buffer); 00136 template <typename T1, typename T2> 00137 const char *decode(std::pair<T1, T2>& val, const char *buffer); 00138 00139 //specialized version of decode for std::vector<bool> due to problems with c++ 00140 //standard on how vector<bool> is defined 00141 DT_DLL_vrfutil const char *decode(std::vector<bool>& val, const char *buffer); 00143 00147 00148 DT_DLL_vrfutil int getSize(const DtString& val) ; 00149 DT_DLL_vrfutil int getSize(const std::string& val); 00150 DT_DLL_vrfutil int getSize(const DtFilename& val) ; 00151 DT_DLL_vrfutil int getSize(const DtVector& v) ; 00152 DT_DLL_vrfutil int getSize(const int& v) ; 00153 DT_DLL_vrfutil int getSize(const DtU8& v) ; 00154 DT_DLL_vrfutil int getSize(const DtU16& v) ; 00155 DT_DLL_vrfutil int getSize(const DtU32& v) ; 00156 DT_DLL_vrfutil int getSize(const DtU64& v) ; 00157 DT_DLL_vrfutil int getSize(const DtFloat32& v) ; 00158 DT_DLL_vrfutil int getSize(const DtFloat64& v) ; 00159 DT_DLL_vrfutil int getSize(const bool&v) ; 00160 DT_DLL_vrfutil int getSize(const DtObjectType& v) ; 00161 DT_DLL_vrfutil int getSize(const DtTaitBryan& v) ; 00162 DT_DLL_vrfutil int getSize(const std::vector<char>& v) ; 00163 DT_DLL_vrfutil int getSize(const DtRwBoolean& v) ; 00164 DT_DLL_vrfutil int getSize(const DtEntityType& v); 00165 DT_DLL_vrfutil int getSize(const DtEntityIdentifier& v); 00166 DT_DLL_vrfutil int getSize(const DtSimulationAddress& v); 00167 DT_DLL_vrfutil int getSize(const DtAppearance& v); 00168 DT_DLL_vrfutil int getSize(const DtForceType& v); 00169 DT_DLL_vrfutil int getSize(const DtInetAddr& v); 00170 DT_DLL_vrfutil int getSize(const DtRwInt& v); 00171 DT_DLL_vrfutil int getSize(const DtRwObjectType& v); 00172 DT_DLL_vrfutil int getSize(const DtRwStringList& v); 00173 template <typename T> 00174 int getSize(const std::vector<T>& v) ; 00175 template <typename T> 00176 int getSize(const std::list<T>& v) ; 00177 template <typename T1, typename T2> 00178 int getSize(const std::map<T1, T2>& v) ; 00179 template <typename T1, typename T2> 00180 int getSize(const std::pair<T1, T2>& v) ; 00181 00182 //specialized version of decode for std::vector<bool> due to problems with c++ 00183 //standard on how vector<bool> is defined 00184 DT_DLL_vrfutil int getSize(const std::vector<bool>& v); 00186 00189 DT_DLL_vrfutil int getSize(const DtSimInterfaceContent* const& contentPtr); 00190 00195 DT_DLL_vrfutil char *encode(const DtSimInterfaceContent* const& adminContentPtr, char *buffer); 00196 00205 DT_DLL_vrfutil const char *decode(DtSimInterfaceContent*& interfaceContentPtr, const char *buffer); 00206 } 00207 00208 #define bufferSerialize_INL_ 00209 #include "vrfutil/bufferSerialize.inl" 00210 #undef bufferSerialize_INL_ 00211 00212 00213 #endif