From: <mk...@us...> - 2003-08-17 08:08:27
|
Update of /cvsroot/csp/APPLICATIONS/SimData/Include/SimData In directory sc8-pr-cvs1:/tmp/cvs-serv9667/Include/SimData Modified Files: DataArchive.h Log Message: Index: DataArchive.h =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/SimData/Include/SimData/DataArchive.h,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** DataArchive.h 16 Aug 2003 10:29:43 -0000 1.19 --- DataArchive.h 17 Aug 2003 08:03:45 -0000 1.20 *************** *** 91,94 **** --- 91,96 ---- private: + typedef std::vector<char> Buffer; + /** An entry in the data archive lookup table. * *************** *** 103,109 **** hasht classhash; /// the file offset of the serialized object ! int32 offset; /// the size of the serialized object data (in bytes) ! int32 length; }; --- 105,111 ---- hasht classhash; /// the file offset of the serialized object ! uint32 offset; /// the size of the serialized object data (in bytes) ! uint32 length; }; *************** *** 133,196 **** /** A table that indexes all objects in the archive. */ ! TableEntry* table; ! int n_objects, allocation; ! /** ! * BUFFERS default buffers of size BUFFERSIZE. * ! * An additional buffer is required for every subobject deserialized ! * by Link<>. If more than BUFFER objects must be deserialized ! * concurrently, or any object exceeds BUFFERSIZE, additional storage ! * will be allocated dynamically. The use of these fixed buffers ! * reduces the need for repeated buffer allocation and deallocation ! * when deserializing many small to medium sized objects. */ - char* object_buffer[BUFFERS]; // vector<string> here? - int n_buffer; - - /////////// - - /* TODO: explore using C++ constructs for data archive storage - - enum { - DEFAULT_BUFFERSIZE = 4096, - DEFAULT_BUFFERS = 10, - }; - - struct Buffer { - char *cbuf; - Buffer(int size=DEFAULT_BUFFERSIZE) { cbuf = new char[size]; } - ~Buffer() { delete[] cbuf; } - }; - - std::vector<TableEntry> _table; std::vector<Buffer> _buffers; ! */ - /////////// ! typedef HASH_MAPS<hasht, std::vector<hasht>, hasht_hash, hasht_eq>::Type child_map; /// A map of all parent-child relationships in the archive. ! child_map _children; ! typedef HASH_MAPS<hasht, std::string, hasht_hash, hasht_eq>::Type path_map; /// A map for accessing the path string of any object id in the archive. ! path_map _pathmap; std::vector<std::string> _paths; ! FILE *f; ! int is_read; ! long table_offset; ! int bytes; ! int finalized; ! hasht_map table_map; std::string _fn; ! bool chain; ! DataManager *manager; ! ! typedef HASH_MAPS<hasht, LinkBase, hasht_hash, hasht_eq>::Type cache_map; ! /// A map of all cached objects indexed by object id. ! cache_map static_map; /** Write a "magic" string to the start of the file to --- 135,179 ---- /** A table that indexes all objects in the archive. */ ! std::vector<TableEntry> _table; ! /** Object read buffers. * ! * An additional buffer is required for every subobject deserialized ! * by Link<>. If more than BUFFER objects must be deserialized ! * concurrently, or any object exceeds BUFFERSIZE, additional storage ! * will be allocated dynamically. The use of these fixed buffers ! * reduces the need for repeated buffer allocation and deallocation ! * when deserializing many small to medium sized objects. */ std::vector<Buffer> _buffers; ! /// The number of buffers currently in use. ! unsigned int _buffer; ! typedef HASH_MAPS<hasht, std::vector<hasht>, hasht_hash, hasht_eq>::Type ChildMap; /// A map of all parent-child relationships in the archive. ! ChildMap _children; ! typedef HASH_MAPS<hasht, std::string, hasht_hash, hasht_eq>::Type PathMap; /// A map for accessing the path string of any object id in the archive. ! PathMap _pathmap; ! ! typedef HASH_MAPS<hasht, std::size_t, hasht_hash, hasht_eq>::Type TableMap; ! /// A map for finding the table index of an object id in the archive. ! TableMap _table_map; ! ! typedef HASH_MAPS<hasht, LinkBase, hasht_hash, hasht_eq>::Type CacheMap; ! /// A map of all cached objects indexed by object id. ! CacheMap _static_map; std::vector<std::string> _paths; ! FILE *_f; ! bool _is_read; ! uint32 _table_offset; ! bool _finalized; std::string _fn; ! bool _chain; ! DataManager *_manager; /** Write a "magic" string to the start of the file to *************** *** 237,244 **** * * @param fn the full path to the archive file ! * @param read nonzero for read mode. * @param chain this is for internal use only. */ ! DataArchive(std::string const &fn, int read, bool chain=true); /** Close the data archive and cleanup. --- 220,227 ---- * * @param fn the full path to the archive file ! * @param read true for read mode, false for write mode. * @param chain this is for internal use only. */ ! DataArchive(std::string const &fn, bool read, bool chain=true); /** Close the data archive and cleanup. *************** *** 439,444 **** private: ! void setManager(DataManager *m) { manager = m; } ! child_map const &getChildMap() const { return _children; } }; --- 422,427 ---- private: ! void setManager(DataManager *m) { _manager = m; } ! ChildMap const &getChildMap() const { return _children; } }; |