<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>persist.h Source File</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> </head><body bgcolor="#ffffff"> <!-- Generated by Doxygen 1.2.10 --> <center> <a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="namespaces.html">Namespace List</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="classes.html">Alphabetical List</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="namespacemembers.html">Namespace Members</a> <a class="qindex" href="functions.html">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> </center> <hr><h1>persist.h</h1><a href="persist_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <font class="comment">// Copyright (C) 1999-2001 Open Source Telecom Corporation.</font> 00002 <font class="comment">// </font> 00003 <font class="comment">// This program is free software; you can redistribute it and/or modify</font> 00004 <font class="comment">// it under the terms of the GNU General Public License as published by</font> 00005 <font class="comment">// the Free Software Foundation; either version 2 of the License, or</font> 00006 <font class="comment">// (at your option) any later version.</font> 00007 <font class="comment">// </font> 00008 <font class="comment">// This program is distributed in the hope that it will be useful,</font> 00009 <font class="comment">// but WITHOUT ANY WARRANTY; without even the implied warranty of</font> 00010 <font class="comment">// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</font> 00011 <font class="comment">// GNU General Public License for more details.</font> 00012 <font class="comment">// </font> 00013 <font class="comment">// You should have received a copy of the GNU General Public License</font> 00014 <font class="comment">// along with this program; if not, write to the Free Software </font> 00015 <font class="comment">// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.</font> 00016 <font class="comment">// </font> 00017 <font class="comment">// As a special exception to the GNU General Public License, permission is </font> 00018 <font class="comment">// granted for additional uses of the text contained in its release </font> 00019 <font class="comment">// of Common C++.</font> 00020 <font class="comment">// </font> 00021 <font class="comment">// The exception is that, if you link the Common C++ library with other</font> 00022 <font class="comment">// files to produce an executable, this does not by itself cause the</font> 00023 <font class="comment">// resulting executable to be covered by the GNU General Public License.</font> 00024 <font class="comment">// Your use of that executable is in no way restricted on account of</font> 00025 <font class="comment">// linking the Common C++ library code into it.</font> 00026 <font class="comment">// </font> 00027 <font class="comment">// This exception does not however invalidate any other reasons why</font> 00028 <font class="comment">// the executable file might be covered by the GNU General Public License.</font> 00029 <font class="comment">// </font> 00030 <font class="comment">// This exception applies only to the code released under the </font> 00031 <font class="comment">// name Common C++. If you copy code from other releases into a copy of</font> 00032 <font class="comment">// Common C++, as the General Public License permits, the exception does</font> 00033 <font class="comment">// not apply to the code that you add in this way. To avoid misleading</font> 00034 <font class="comment">// anyone as to the status of such modified files, you must delete</font> 00035 <font class="comment">// this exception notice from them.</font> 00036 <font class="comment">// </font> 00037 <font class="comment">// If you write modifications of your own for Common C++, it is your choice</font> 00038 <font class="comment">// whether to permit this exception to apply to your modifications.</font> 00039 <font class="comment">// If you do not wish that, delete this exception notice. </font> 00040 00041 <font class="preprocessor">#ifndef CCXX_PERSIST_H_</font> 00042 <font class="preprocessor"></font><font class="preprocessor">#define CCXX_PERSIST_H_</font> 00043 <font class="preprocessor"></font> 00044 <font class="preprocessor">#ifndef CCXX_CONFIG_H_</font> 00045 <font class="preprocessor"></font><font class="preprocessor">#include <cc++/config.h></font> 00046 <font class="preprocessor">#endif</font> 00047 <font class="preprocessor"></font> 00048 <font class="preprocessor">#ifndef CCXX_STRCHAR_H_</font> 00049 <font class="preprocessor"></font><font class="preprocessor">#include <<a class="code" href="persist_8h.html">cc++/persist.h</a>></font> 00050 <font class="preprocessor">#endif</font> 00051 <font class="preprocessor"></font> 00052 <font class="preprocessor">#ifdef HAVE_ZLIB_H</font> 00053 <font class="preprocessor"></font><font class="preprocessor">#ifndef NO_COMPRESSION</font> 00054 <font class="preprocessor"></font><font class="preprocessor">#include <zlib.h></font> 00055 <font class="preprocessor">#endif</font> 00056 <font class="preprocessor"></font><font class="preprocessor">#else</font> 00057 <font class="preprocessor"></font><font class="preprocessor">#define NO_COMPRESSION</font> 00058 <font class="preprocessor"></font><font class="preprocessor">#endif</font> 00059 <font class="preprocessor"></font> 00060 <font class="preprocessor">#include <iostream></font> 00061 <font class="preprocessor">#include <string></font> 00062 <font class="preprocessor">#include <vector></font> 00063 <font class="preprocessor">#include <map></font> 00064 00065 <font class="preprocessor">#ifdef CCXX_NAMESPACES</font> 00066 <font class="preprocessor"></font><font class="keyword">namespace </font>ost { 00067 <font class="preprocessor">#endif</font> 00068 <font class="preprocessor"></font> <a name="l00069"></a><a class="code" href="classost_1_1_persist_exception.html">00069</a> <font class="keyword">class </font>PersistException 00070 { 00071 <font class="keyword">public</font>: 00072 CCXX_MEMBER_EXPORT(CCXX_EMPTY) <a class="code" href="classost_1_1_persist_exception.html#a0">PersistException</a>(<font class="keyword">const</font> std::string& reason); 00073 CCXX_MEMBER_EXPORT(<font class="keyword">const</font> std::string&) <a class="code" href="classost_1_1_persist_exception.html#a1">GetMessage</a>() <font class="keyword">const</font>; 00074 CCXX_MEMBER_EXPORT(<font class="keyword">virtual</font>) <a class="code" href="classost_1_1_persist_exception.html#a2">~PersistException</a>(); 00075 <font class="keyword">protected</font>: <a name="l00076"></a><a class="code" href="classost_1_1_persist_exception.html#n0">00076</a> std::string myMessage; 00077 }; 00078 00079 <font class="comment">// This typedef allows us to declare NewBaseObjectFunction now</font> <a name="l00080"></a><a class="code" href="namespaceost.html#a40">00080</a> <font class="keyword">typedef</font> <font class="keyword">class </font>BaseObject* (*NewBaseObjectFunction) (void); 00081 <a name="l00090"></a><a class="code" href="classost_1_1_type_manager.html">00090</a> <font class="keyword">class </font>TypeManager 00091 { 00092 <font class="keyword">public</font>: 00093 <a name="l00098"></a><a class="code" href="classost_1_1_type_manager_1_1_registration.html">00098</a> <font class="keyword">class </font>Registration 00099 { 00100 <font class="keyword">public</font>: <a name="l00101"></a><a class="code" href="classost_1_1_type_manager_1_1_registration.html#a0">00101</a> <a class="code" href="classost_1_1_type_manager_1_1_registration.html#a0">Registration</a>(<font class="keyword">const</font> <font class="keywordtype">char</font>* name, NewBaseObjectFunction func) 00102 : myName(name) { TypeManager::Add(name,func); } <a name="l00103"></a><a class="code" href="classost_1_1_type_manager_1_1_registration.html#a1">00103</a> <font class="keyword">virtual</font> <a class="code" href="classost_1_1_type_manager_1_1_registration.html#a1">~Registration</a>()<font class="keyword"> </font>{ TypeManager::Remove(myName.c_str()); } 00104 <font class="keyword">private</font>: 00105 std::string myName; 00106 }; 00107 00111 CCXX_MEMBER_EXPORT(<font class="keyword">static</font> <font class="keywordtype">void</font>) <a class="code" href="classost_1_1_type_manager.html#d0">Add</a>(<font class="keyword">const</font> <font class="keywordtype">char</font>* name, NewBaseObjectFunction construction); 00112 00116 CCXX_MEMBER_EXPORT(<font class="keyword">static</font> <font class="keywordtype">void</font>) <a class="code" href="classost_1_1_type_manager.html#d1">Remove</a>(<font class="keyword">const</font> <font class="keywordtype">char</font>* name); 00117 00123 CCXX_EXPORT(<font class="keyword">static</font> BaseObject*) <a class="code" href="classost_1_1_type_manager.html#d2">CreateInstanceOf</a>(<font class="keyword">const</font> <font class="keywordtype">char</font>* name); 00124 <a name="l00125"></a><a class="code" href="classost_1_1_type_manager.html#s0">00125</a> <font class="keyword">typedef</font> std::map<std::string,NewBaseObjectFunction> StringFunctionMap; 00126 }; 00127 00128 00129 <font class="comment">/*</font> 00130 <font class="comment"> * The following defines are used to declare and define the relevant code</font> 00131 <font class="comment"> * to allow a class to use the Persistence::Engine code.</font> 00132 <font class="comment"> */</font> 00133 <a name="l00134"></a><a class="code" href="persist_8h.html#a0">00134</a> <font class="preprocessor">#define DECLARE_PERSISTENCE(ClassType) \</font> 00135 <font class="preprocessor"> public: \</font> 00136 <font class="preprocessor"> friend Engine& operator>>(Engine& ar, ClassType *&ob); \</font> 00137 <font class="preprocessor"> friend Engine& operator<<(Engine& ar, ClassType const *&ob); \</font> 00138 <font class="preprocessor"> friend BaseObject *CreateNew##ClassType(); \</font> 00139 <font class="preprocessor"> virtual const char* GetPersistenceID() const; \</font> 00140 <font class="preprocessor"> static TypeManager::Registration RegistrationFor##ClassType;</font> 00141 <font class="preprocessor"></font> <a name="l00142"></a><a class="code" href="persist_8h.html#a1">00142</a> <font class="preprocessor">#define IMPLEMENT_PERSISTENCE(ClassType,FullyQualifiedName) \</font> 00143 <font class="preprocessor"> BaseObject *CreateNew##ClassType() { return new ClassType; } \</font> 00144 <font class="preprocessor"> const char* ClassType::GetPersistenceID()const {return FullyQualifiedName;} \</font> 00145 <font class="preprocessor"> Engine& operator>>(Engine& ar, ClassType *&ob) \</font> 00146 <font class="preprocessor"> { ar >> (BaseObject *&) ob; return ar; } \</font> 00147 <font class="preprocessor"> Engine& operator<<(Engine& ar, ClassType const *ob) \</font> 00148 <font class="preprocessor"> { ar << (BaseObject const *)ob; return ar; } \</font> 00149 <font class="preprocessor"> TypeManager::Registration \</font> 00150 <font class="preprocessor"> ClassType::RegistrationFor##ClassType(FullyQualifiedName, \</font> 00151 <font class="preprocessor"> CreateNew##ClassType);</font> 00152 <font class="preprocessor"></font> 00153 <font class="keyword">class </font>Engine; 00154 <a name="l00169"></a><a class="code" href="classost_1_1_base_object.html">00169</a> <font class="keyword">class </font>BaseObject 00170 { 00171 <font class="keyword">public</font>: 00177 CCXX_MEMBER_EXPORT(CCXX_EMPTY) <a class="code" href="classost_1_1_base_object.html#a0">BaseObject</a>(); 00178 00182 CCXX_MEMBER_EXPORT(<font class="keyword">virtual</font>) <a class="code" href="classost_1_1_base_object.html#a1">~BaseObject</a>(); 00183 00187 CCXX_MEMBER_EXPORT(<font class="keyword">virtual</font> <font class="keyword">const</font> <font class="keywordtype">char</font>*) <a class="code" href="classost_1_1_base_object.html#a2">GetPersistenceID</a>() <font class="keyword">const</font>; 00188 00194 CCXX_MEMBER_EXPORT(<font class="keyword">virtual</font> <font class="keywordtype">bool</font>) <a class="code" href="classost_1_1_base_object.html#a3">Write</a>(Engine& archive) <font class="keyword">const</font>; 00195 00201 CCXX_MEMBER_EXPORT(<font class="keyword">virtual</font> <font class="keywordtype">bool</font>) <a class="code" href="classost_1_1_base_object.html#a4">Read</a>(Engine& archive); 00202 }; 00203 00204 <a name="l00215"></a><a class="code" href="classost_1_1_engine.html">00215</a> <font class="keyword">class </font>Engine 00216 { 00217 <font class="keyword">public</font>: <a name="l00222"></a><a class="code" href="classost_1_1_engine_1_1_exception.html">00222</a> <font class="keyword">class </font>Exception : <font class="keyword">public</font> PersistException 00223 { 00224 <font class="keyword">public</font>: <a name="l00225"></a><a class="code" href="classost_1_1_engine_1_1_exception.html#a0">00225</a> CCXX_MEMBER_EXPORT(CCXX_EMPTY) <a class="code" href="classost_1_1_engine_1_1_exception.html#a0">Exception</a>(<font class="keyword">const</font> std::string &reason) : PersistException(reason) {} 00226 }; 00227 <a name="l00231"></a><a class="code" href="classost_1_1_engine.html#s2">00231</a> <font class="keyword">enum</font> EngineMode 00232 { 00233 modeRead, 00234 modeWrite 00235 }; 00236 00242 CCXX_MEMBER_EXPORT(CCXX_EMPTY) <a class="code" href="classost_1_1_engine.html#a0">Engine</a>(<a class="code" href="classstd_1_1iostream.html">std::iostream</a>& stream, EngineMode mode) THROWS (PersistException); 00243 00248 CCXX_MEMBER_EXPORT(<font class="keyword">virtual</font>) <a class="code" href="classost_1_1_engine.html#a1">~Engine</a>(); 00249 00250 00251 <font class="comment">// Write operations</font> 00252 CCXX_MEMBER_EXPORT(<font class="keywordtype">void</font>) <a class="code" href="classost_1_1_engine.html#a2">Write</a>(<font class="keyword">const</font> BaseObject *object) THROWS (Exception); 00253 <font class="comment">/*</font> 00254 <font class="comment"> * shortcut, to make the following more readable</font> 00255 <font class="comment"> */</font> <a name="l00256"></a><a class="code" href="persist_8h.html#a2">00256</a> <font class="preprocessor">#define CCXX_ENGINEWRITE_REF(valref) WriteBinary((const uint8*)&valref,sizeof(valref))</font> <a name="l00257"></a><a class="code" href="classost_1_1_engine.html#a3">00257</a> <font class="preprocessor"></font> <font class="keywordtype">void</font> <a class="code" href="classost_1_1_engine.html#a2">Write</a>(int8 i) THROWS (Exception)<font class="keyword"> </font>{ <a class="code" href="persist_8h.html#a2">CCXX_ENGINEWRITE_REF</a>(i); } <a name="l00258"></a><a class="code" href="classost_1_1_engine.html#a4">00258</a> <font class="keywordtype">void</font> <a class="code" href="classost_1_1_engine.html#a2">Write</a>(uint8 i) THROWS (Exception)<font class="keyword"> </font>{ <a class="code" href="persist_8h.html#a2">CCXX_ENGINEWRITE_REF</a>(i); } <a name="l00259"></a><a class="code" href="classost_1_1_engine.html#a5">00259</a> <font class="keywordtype">void</font> <a class="code" href="classost_1_1_engine.html#a2">Write</a>(int16 i) THROWS (Exception)<font class="keyword"> </font>{ <a class="code" href="persist_8h.html#a2">CCXX_ENGINEWRITE_REF</a>(i); } <a name="l00260"></a><a class="code" href="classost_1_1_engine.html#a6">00260</a> <font class="keywordtype">void</font> <a class="code" href="classost_1_1_engine.html#a2">Write</a>(uint16 i) THROWS (Exception)<font class="keyword"> </font>{ <a class="code" href="persist_8h.html#a2">CCXX_ENGINEWRITE_REF</a>(i); } <a name="l00261"></a><a class="code" href="classost_1_1_engine.html#a7">00261</a> <font class="keywordtype">void</font> <a class="code" href="classost_1_1_engine.html#a2">Write</a>(int32 i) THROWS (Exception)<font class="keyword"> </font>{ <a class="code" href="persist_8h.html#a2">CCXX_ENGINEWRITE_REF</a>(i); } <a name="l00262"></a><a class="code" href="classost_1_1_engine.html#a8">00262</a> <font class="keywordtype">void</font> <a class="code" href="classost_1_1_engine.html#a2">Write</a>(uint32 i) THROWS (Exception)<font class="keyword"> </font>{ <a class="code" href="persist_8h.html#a2">CCXX_ENGINEWRITE_REF</a>(i); } <a name="l00263"></a><a class="code" href="classost_1_1_engine.html#a9">00263</a> <font class="keywordtype">void</font> <a class="code" href="classost_1_1_engine.html#a2">Write</a>(int64 i) THROWS (Exception)<font class="keyword"> </font>{ <a class="code" href="persist_8h.html#a2">CCXX_ENGINEWRITE_REF</a>(i); } <a name="l00264"></a><a class="code" href="classost_1_1_engine.html#a10">00264</a> <font class="keywordtype">void</font> <a class="code" href="classost_1_1_engine.html#a2">Write</a>(uint64 i) THROWS (Exception)<font class="keyword"> </font>{ <a class="code" href="persist_8h.html#a2">CCXX_ENGINEWRITE_REF</a>(i); } <a name="l00265"></a><a class="code" href="classost_1_1_engine.html#a11">00265</a> <font class="keywordtype">void</font> <a class="code" href="classost_1_1_engine.html#a2">Write</a>(<font class="keywordtype">float</font> i) THROWS (Exception)<font class="keyword"> </font>{ <a class="code" href="persist_8h.html#a2">CCXX_ENGINEWRITE_REF</a>(i); } <a name="l00266"></a><a class="code" href="classost_1_1_engine.html#a12">00266</a> <font class="keywordtype">void</font> <a class="code" href="classost_1_1_engine.html#a2">Write</a>(<font class="keywordtype">double</font> i) THROWS (Exception)<font class="keyword"> </font>{ <a class="code" href="persist_8h.html#a2">CCXX_ENGINEWRITE_REF</a>(i); } 00267 <font class="preprocessor">#undef CCXX_ENGINEWRITE_REF</font> 00268 <font class="preprocessor"></font> 00269 CCXX_MEMBER_EXPORT(<font class="keywordtype">void</font>) <a class="code" href="classost_1_1_engine.html#a2">Write</a>(<font class="keyword">const</font> std::string& str) THROWS (Exception); 00270 <font class="comment">// Every write operation boils down to one or more of theses</font> 00271 CCXX_MEMBER_EXPORT(<font class="keywordtype">void</font>) <a class="code" href="classost_1_1_engine.html#a14">WriteBinary</a>(<font class="keyword">const</font> uint8* data, <font class="keyword">const</font> uint32 size) THROWS (Exception); 00272 00273 <font class="comment">// Read Operations</font> 00274 00275 CCXX_MEMBER_EXPORT(<font class="keywordtype">void</font>) <a class="code" href="classost_1_1_engine.html#a15">Read</a>(BaseObject *&object) THROWS (Exception); <a name="l00276"></a><a class="code" href="persist_8h.html#a3">00276</a> <font class="preprocessor">#define CCXX_ENGINEREAD_REF(valref) ReadBinary((uint8*)&valref,sizeof(valref))</font> <a name="l00277"></a><a class="code" href="classost_1_1_engine.html#a16">00277</a> <font class="preprocessor"></font> <font class="keywordtype">void</font> <a class="code" href="classost_1_1_engine.html#a15">Read</a>(int8& i) THROWS (Exception)<font class="keyword"> </font>{ <a class="code" href="persist_8h.html#a3">CCXX_ENGINEREAD_REF</a>(i); } <a name="l00278"></a><a class="code" href="classost_1_1_engine.html#a17">00278</a> <font class="keywordtype">void</font> <a class="code" href="classost_1_1_engine.html#a15">Read</a>(uint8& i) THROWS (Exception)<font class="keyword"> </font>{ <a class="code" href="persist_8h.html#a3">CCXX_ENGINEREAD_REF</a>(i); } <a name="l00279"></a><a class="code" href="classost_1_1_engine.html#a18">00279</a> <font class="keywordtype">void</font> <a class="code" href="classost_1_1_engine.html#a15">Read</a>(int16& i) THROWS (Exception)<font class="keyword"> </font>{ <a class="code" href="persist_8h.html#a3">CCXX_ENGINEREAD_REF</a>(i); } <a name="l00280"></a><a class="code" href="classost_1_1_engine.html#a19">00280</a> <font class="keywordtype">void</font> <a class="code" href="classost_1_1_engine.html#a15">Read</a>(uint16& i) THROWS (Exception)<font class="keyword"> </font>{ <a class="code" href="persist_8h.html#a3">CCXX_ENGINEREAD_REF</a>(i); } <a name="l00281"></a><a class="code" href="classost_1_1_engine.html#a20">00281</a> <font class="keywordtype">void</font> <a class="code" href="classost_1_1_engine.html#a15">Read</a>(int32& i) THROWS (Exception)<font class="keyword"> </font>{ <a class="code" href="persist_8h.html#a3">CCXX_ENGINEREAD_REF</a>(i); } <a name="l00282"></a><a class="code" href="classost_1_1_engine.html#a21">00282</a> <font class="keywordtype">void</font> <a class="code" href="classost_1_1_engine.html#a15">Read</a>(uint32& i) THROWS (Exception)<font class="keyword"> </font>{ <a class="code" href="persist_8h.html#a3">CCXX_ENGINEREAD_REF</a>(i); } <a name="l00283"></a><a class="code" href="classost_1_1_engine.html#a22">00283</a> <font class="keywordtype">void</font> <a class="code" href="classost_1_1_engine.html#a15">Read</a>(int64& i) THROWS (Exception)<font class="keyword"> </font>{ <a class="code" href="persist_8h.html#a3">CCXX_ENGINEREAD_REF</a>(i); } <a name="l00284"></a><a class="code" href="classost_1_1_engine.html#a23">00284</a> <font class="keywordtype">void</font> <a class="code" href="classost_1_1_engine.html#a15">Read</a>(uint64& i) THROWS (Exception)<font class="keyword"> </font>{ <a class="code" href="persist_8h.html#a3">CCXX_ENGINEREAD_REF</a>(i); } <a name="l00285"></a><a class="code" href="classost_1_1_engine.html#a24">00285</a> <font class="keywordtype">void</font> <a class="code" href="classost_1_1_engine.html#a15">Read</a>(<font class="keywordtype">float</font>& i) THROWS (Exception)<font class="keyword"> </font>{ <a class="code" href="persist_8h.html#a3">CCXX_ENGINEREAD_REF</a>(i); } <a name="l00286"></a><a class="code" href="classost_1_1_engine.html#a25">00286</a> <font class="keywordtype">void</font> <a class="code" href="classost_1_1_engine.html#a15">Read</a>(<font class="keywordtype">double</font>& i) THROWS (Exception)<font class="keyword"> </font>{ <a class="code" href="persist_8h.html#a3">CCXX_ENGINEREAD_REF</a>(i); } 00287 <font class="preprocessor">#undef CCXX_ENGINEREAD_REF</font> 00288 <font class="preprocessor"></font> 00289 CCXX_MEMBER_EXPORT(<font class="keywordtype">void</font>) <a class="code" href="classost_1_1_engine.html#a15">Read</a>(std::string& str) THROWS (Exception); 00290 <font class="comment">// Every read operation boild down to one or more of these</font> 00291 CCXX_MEMBER_EXPORT(<font class="keywordtype">void</font>) <a class="code" href="classost_1_1_engine.html#a27">ReadBinary</a>(uint8* data, uint32 size) THROWS (Exception); 00292 00293 <font class="keyword">private</font>: 00297 <a class="code" href="classstd_1_1iostream.html">std::iostream</a>& myUnderlyingStream; 00298 00302 EngineMode myOperationalMode; 00303 00307 <font class="keyword">typedef</font> std::vector<BaseObject*> ArchiveVector; 00308 <font class="keyword">typedef</font> std::map<BaseObject const*, int32> ArchiveMap; 00309 <font class="keyword">typedef</font> std::vector<std::string> ClassVector; 00310 <font class="keyword">typedef</font> std::map<std::string, int32> ClassMap; 00311 00312 ArchiveVector myArchiveVector; 00313 ArchiveMap myArchiveMap; 00314 ClassVector myClassVector; 00315 ClassMap myClassMap; 00316 00317 <font class="comment">// Compression support</font> 00318 <font class="preprocessor">#ifndef NO_COMPRESSION</font> 00319 <font class="preprocessor"></font> z_stream myZStream; 00320 uint8* myCompressedDataBuffer; 00321 uint8* myUncompressedDataBuffer; 00322 uint8* myLastUncompressedDataRead; 00323 <font class="preprocessor">#endif</font> 00324 <font class="preprocessor"></font>}; 00325 00326 <font class="comment">// Standard >> and << stream operators for BaseObject</font> 00327 CCXX_EXPORT(Engine&) <a class="code" href="namespaceost.html#a185">operator >></a>( Engine& ar, BaseObject *&ob) THROWS (Engine::Exception); 00328 CCXX_EXPORT(Engine&) <a class="code" href="namespaceost.html#a186">operator <<</a>( Engine& ar, BaseObject <font class="keyword">const</font> *ob) THROWS (Engine::Exception); 00329 00330 CCXX_EXPORT(Engine&) <a class="code" href="namespaceost.html#a185">operator >></a>( Engine& ar, int8& ob) THROWS (Engine::Exception); 00331 CCXX_EXPORT(Engine&) <a class="code" href="namespaceost.html#a186">operator <<</a>( Engine& ar, int8 ob) THROWS (Engine::Exception); 00332 00333 CCXX_EXPORT(Engine&) <a class="code" href="namespaceost.html#a185">operator >></a>( Engine& ar, uint8& ob) THROWS (Engine::Exception); 00334 CCXX_EXPORT(Engine&) <a class="code" href="namespaceost.html#a186">operator <<</a>( Engine& ar, uint8 ob) THROWS (Engine::Exception); 00335 00336 CCXX_EXPORT(Engine&) <a class="code" href="namespaceost.html#a185">operator >></a>( Engine& ar, int16& ob) THROWS (Engine::Exception); 00337 CCXX_EXPORT(Engine&) <a class="code" href="namespaceost.html#a186">operator <<</a>( Engine& ar, int16 ob) THROWS (Engine::Exception); 00338 00339 CCXX_EXPORT(Engine&) <a class="code" href="namespaceost.html#a185">operator >></a>( Engine& ar, uint16& ob) THROWS (Engine::Exception); 00340 CCXX_EXPORT(Engine&) <a class="code" href="namespaceost.html#a186">operator <<</a>( Engine& ar, uint16 ob) THROWS (Engine::Exception); 00341 00342 CCXX_EXPORT(Engine&) <a class="code" href="namespaceost.html#a185">operator >></a>( Engine& ar, int32& ob) THROWS (Engine::Exception); 00343 CCXX_EXPORT(Engine&) <a class="code" href="namespaceost.html#a186">operator <<</a>( Engine& ar, int32 ob) THROWS (Engine::Exception); 00344 00345 CCXX_EXPORT(Engine&) <a class="code" href="namespaceost.html#a185">operator >></a>( Engine& ar, uint32& ob) THROWS (Engine::Exception); 00346 CCXX_EXPORT(Engine&) <a class="code" href="namespaceost.html#a186">operator <<</a>( Engine& ar, uint32 ob) THROWS (Engine::Exception); 00347 00348 CCXX_EXPORT(Engine&) <a class="code" href="namespaceost.html#a185">operator >></a>( Engine& ar, int64& ob) THROWS (Engine::Exception); 00349 CCXX_EXPORT(Engine&) <a class="code" href="namespaceost.html#a186">operator <<</a>( Engine& ar, int64 ob) THROWS (Engine::Exception); 00350 00351 CCXX_EXPORT(Engine&) <a class="code" href="namespaceost.html#a185">operator >></a>( Engine& ar, uint64& ob) THROWS (Engine::Exception); 00352 CCXX_EXPORT(Engine&) <a class="code" href="namespaceost.html#a186">operator <<</a>( Engine& ar, uint64 ob) THROWS (Engine::Exception); 00353 00354 CCXX_EXPORT(Engine&) <a class="code" href="namespaceost.html#a185">operator >></a>( Engine& ar, <font class="keywordtype">float</font>& ob) THROWS (Engine::Exception); 00355 CCXX_EXPORT(Engine&) <a class="code" href="namespaceost.html#a186">operator <<</a>( Engine& ar, <font class="keywordtype">float</font> ob) THROWS (Engine::Exception); 00356 00357 CCXX_EXPORT(Engine&) <a class="code" href="namespaceost.html#a185">operator >></a>( Engine& ar, <font class="keywordtype">double</font>& ob) THROWS (Engine::Exception); 00358 CCXX_EXPORT(Engine&) <a class="code" href="namespaceost.html#a186">operator <<</a>( Engine& ar, <font class="keywordtype">double</font> ob) THROWS (Engine::Exception); 00359 00360 CCXX_EXPORT(Engine&) <a class="code" href="namespaceost.html#a185">operator >></a>( Engine& ar, std::string& ob) THROWS (Engine::Exception); 00361 CCXX_EXPORT(Engine&) <a class="code" href="namespaceost.html#a186">operator <<</a>( Engine& ar, std::string ob) THROWS (Engine::Exception); 00362 00363 CCXX_EXPORT(Engine&) <a class="code" href="namespaceost.html#a185">operator >></a>( Engine& ar, <font class="keywordtype">bool</font>& ob) THROWS (Engine::Exception); 00364 CCXX_EXPORT(Engine&) <a class="code" href="namespaceost.html#a186">operator <<</a>( Engine& ar, <font class="keywordtype">bool</font> ob) THROWS (Engine::Exception); 00365 00374 template<class T> <a name="l00375"></a><a class="code" href="namespaceost.html#a211">00375</a> Engine& operator <<( Engine& ar, std::vector<T> <font class="keyword">const</font>& ob) THROWS (Engine::Exception)<font class="keyword"></font> 00376 <font class="keyword"></font>{ 00377 ar << (uint32)ob.size(); 00378 <font class="keywordflow">for</font>(uint i=0; i < ob.size(); ++i) 00379 ar << ob[i]; 00380 <font class="keywordflow">return</font> ar; 00381 } 00382 00387 template<class T> <a name="l00388"></a><a class="code" href="namespaceost.html#a212">00388</a> Engine& <a class="code" href="namespaceost.html#a185">operator >></a>( Engine& ar, std::vector<T>& ob) THROWS (Engine::Exception)<font class="keyword"></font> 00389 <font class="keyword"></font>{ 00390 ob.clear(); 00391 uint32 siz; 00392 ar >> siz; 00393 ob.resize(siz); 00394 <font class="keywordflow">for</font>(uint32 i=0; i < siz; ++i) 00395 ar >> ob[i]; 00396 <font class="keywordflow">return</font> ar; 00397 } 00398 00403 template<class Key, class Value> <a name="l00404"></a><a class="code" href="namespaceost.html#a213">00404</a> Engine& operator <<( Engine& ar, std::map<Key,Value> <font class="keyword">const</font> & ob) THROWS (Engine::Exception)<font class="keyword"></font> 00405 <font class="keyword"></font>{ 00406 ar << (uint32)ob.size(); 00407 <font class="keywordflow">for</font>(<font class="keyword">typename</font> std::map<Key,Value>::const_iterator it = ob.begin();it != ob.end();++it) 00408 ar << it->first << it->second; 00409 <font class="keywordflow">return</font> ar; 00410 } 00411 00416 template<class Key, class Value> <a name="l00417"></a><a class="code" href="namespaceost.html#a214">00417</a> Engine& <a class="code" href="namespaceost.html#a185">operator >></a>( Engine& ar, std::map<Key,Value>& ob) THROWS (Engine::Exception)<font class="keyword"></font> 00418 <font class="keyword"></font>{ 00419 ob.clear(); 00420 uint32 siz; 00421 ar >> siz; 00422 <font class="keywordflow">for</font>(uint32 i=0; i < siz; ++i) { 00423 Key a; 00424 ar >> a; 00425 ar >> ob[a]; 00426 } 00427 <font class="keywordflow">return</font> ar; 00428 } 00429 00430 <font class="preprocessor">#ifdef CCXX_NAMESPACES</font> 00431 <font class="preprocessor"></font>}; 00432 <font class="preprocessor">#endif</font> 00433 <font class="preprocessor"></font> 00434 <font class="preprocessor">#endif</font> 00435 <font class="preprocessor"></font> </pre></div><hr><address><small>Generated at Fri Jan 4 18:51:45 2002 for CommonC++ by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.gif" alt="doxygen" align="middle" border=0 width=110 height=53></a>1.2.10 written by <a href="mailto:dimitri@stack.nl">Dimitri van Heesch</a>, © 1997-2001</small></address> </body> </html>