From: <sv...@ww...> - 2004-06-21 06:38:34
|
Author: mkrose Date: 2004-06-20 23:38:27 -0700 (Sun, 20 Jun 2004) New Revision: 1052 Modified: trunk/CSP/SimData/CHANGES.current trunk/CSP/SimData/Include/SimData/Archive.h trunk/CSP/SimData/Include/SimData/PTS.h Log: Minor doc and copyright notice fixes. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1052 Modified: trunk/CSP/SimData/CHANGES.current =================================================================== --- trunk/CSP/SimData/CHANGES.current 2004-06-17 06:36:15 UTC (rev 1051) +++ trunk/CSP/SimData/CHANGES.current 2004-06-21 06:38:27 UTC (rev 1052) @@ -1,6 +1,9 @@ Version 0.4.0 (in progress) =========================== +2004-06-20: onsight + * Doxygen and copyright notice updates. + 2004-06-16: onsight * Doxygen cleanups. Modified: trunk/CSP/SimData/Include/SimData/Archive.h =================================================================== --- trunk/CSP/SimData/Include/SimData/Archive.h 2004-06-17 06:36:15 UTC (rev 1051) +++ trunk/CSP/SimData/Include/SimData/Archive.h 2004-06-21 06:38:27 UTC (rev 1052) @@ -1,5 +1,5 @@ /* SimData: Data Infrastructure for Simulations - * Copyright (C) 2002 Mark Rose <tm...@st...> + * Copyright 2002, 2003, 2004 Mark Rose <mk...@us...> * * This file is part of SimData. * @@ -50,29 +50,50 @@ SIMDATA_EXCEPTION(SerializeError); +/** A trivial FILE * wrapper to provide a uniform file interface for both + * C++ and Python. + */ class SIMDATA_EXPORT PackFile { FILE *_f; bool _open; public: + #ifndef SWIG + /** Retrieve the underlying FILE pointer. + */ operator FILE*() { return _f; } - PackFile(FILE* f): _f(f), _open(false) {} + + /** Wrap an existing (open) FILE pointer. + */ + PackFile(FILE* f): _f(f), _open(false) { + _open = (_f != 0); + } #endif + + /** Open a new file (fopen interface) + */ PackFile(const char *fn, const char *mode) { _f = (FILE*) fopen(fn, mode); assert(_f); // XXX add error handling _open = (_f != 0); } + + /** Close the current file, if open. + */ void close() { if (_open) { - fclose(_f); + if (_f) fclose(_f); + _f = 0; _open = false; } } }; - +/** + * Abstract base class for serializing standard types and BaseTypes + * from a data source. + */ class SIMDATA_EXPORT Reader { public: virtual ~Reader() {} @@ -214,7 +235,8 @@ /** - * + * Abstract base class for serializing standard types and BaseTypes + * to a data source. */ class SIMDATA_EXPORT Writer { public: @@ -273,7 +295,7 @@ * and provides methods to write variables of various types to * the file in a standard format. * - * @author Mark Rose <tm...@st...> + * @author Mark Rose <mk...@us...> */ class SIMDATA_EXPORT ArchiveWriter: public Writer { FILE *_f; @@ -355,7 +377,7 @@ * needed to reconstruct the object, and provides access methods * for translating the raw bytes into variables of various types. * - * @author Mark Rose <tm...@st...> + * @author Mark Rose <mk...@us...> */ class SIMDATA_EXPORT ArchiveReader: public Reader { const char* _d; @@ -467,12 +489,15 @@ }; +/** Writer class for serializing data to a memory buffer. + * + * This class currently uses a fixed size memory buffer, that + * must be preallocated with sufficient space to store all + * data that is serialized. + */ class SIMDATA_EXPORT MemoryWriter: public Writer { uint8 * _ptr; int _n; - //void write(const void* x, int n) { - // fwrite(x, n, 1, _f); - //} public: MemoryWriter(uint8 * ptr): Writer(), _n(0) { _ptr = ptr; @@ -549,12 +574,14 @@ }; +/** Reader class for serializing data from a memory buffer. + * + * The current implementation does not check for serialization + * underflows or overflows. + */ class SIMDATA_EXPORT MemoryReader: public Reader { uint8 * _ptr; int _n; - //void write(const void* x, int n) { - // fwrite(x, n, 1, _f); - //} public: MemoryReader(uint8 * ptr): Reader(), _n(0) { _ptr = ptr; Modified: trunk/CSP/SimData/Include/SimData/PTS.h =================================================================== --- trunk/CSP/SimData/Include/SimData/PTS.h 2004-06-17 06:36:15 UTC (rev 1051) +++ trunk/CSP/SimData/Include/SimData/PTS.h 2004-06-21 06:38:27 UTC (rev 1052) @@ -1,18 +1,18 @@ /* SimData: Data Infrastructure for Simulations - * Copyright (C) 2002 Mark Rose <tm...@st...> - * + * Copyright (C) 2002 Mark Rose <mk...@us...> + * * This file is part of SimData. - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |