Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

DataManager.h

Go to the documentation of this file.
00001 /* SimData: Data Infrastructure for Simulations
00002  * Copyright (C) 2002, 2003 Mark Rose <tm2@stm.lbl.gov>
00003  * 
00004  * This file is part of SimData.
00005  * 
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * as published by the Free Software Foundation; either version 2
00009  * of the License, or (at your option) any later version.
00010  * 
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  * 
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00019  */
00020 
00027 #ifndef __SIMDATA_DATAMANAGER_H__
00028 #define __SIMDATA_DATAMANAGER_H__
00029 
00030 #include <SimData/Export.h>
00031 #include <SimData/Namespace.h>
00032 #include <SimData/Path.h>
00033 #include <SimData/HashUtility.h>
00034 #include <SimData/Ref.h>
00035 
00036 #include <string>
00037 #include <cstdio>
00038 #include <cstdlib>
00039 #include <vector>
00040 
00041 
00042 
00043 NAMESPACE_SIMDATA
00044 
00045 
00046 class DataArchive;
00047 class LinkBase;
00048 class InterfaceProxy;
00049 
00050 
00055 class SIMDATA_EXPORT DataManager {
00056         friend class DataArchive;
00057 
00058 public:
00061         DataManager();
00062 
00065         virtual ~DataManager();
00066         
00072         const LinkBase getObject(std::string const &path_str);
00073 
00080         const LinkBase getObject(Path const& path, std::string const &path_str="");
00081 
00088         void addArchive(DataArchive *);
00089 
00098         std::vector<ObjectID> getChildren(ObjectID const &id) const;
00099 
00108         std::vector<ObjectID> getChildren(std::string const & path) const;
00109 
00114         bool hasObject(ObjectID const &id) const;
00115 
00120         bool hasObject(std::string const & path) const;
00121 
00129         std::string getPathString(ObjectID const &id) const; 
00130 
00136         void cleanStatic();
00137 
00141         InterfaceProxy *getObjectInterface(ObjectID const &id) const;
00142 
00146         InterfaceProxy *getObjectInterface(std::string const &path) const;
00147 
00150         void closeAll();
00151 
00152 private:
00157         DataArchive *findArchive(ObjectID const &id, std::string const &path_str, DataArchive const *d) const;
00158 
00171         const LinkBase getObject(Path const& path, std::string const &path_str, DataArchive const *d) const;
00172 
00181         InterfaceProxy *getObjectInterface(ObjectID const &id, std::string const &path_str, DataArchive const *d) const;
00182         
00183         typedef std::vector<DataArchive *> Archives;
00185         Archives _archives;
00186 
00187         typedef HASH_MAPS<ObjectID, std::size_t, ObjectID_hash, ObjectID_eq>::Type ArchiveMap;
00189         ArchiveMap _archive_map;
00190 
00191         typedef HASH_MAPS<ObjectID, std::vector<hasht>, ObjectID_hash, ObjectID_eq>::Type ChildMap;
00193         ChildMap _children;
00194 };
00195 
00196 
00197 NAMESPACE_SIMDATA_END
00198 
00199 #endif //__SIMDATA_DATAMANAGER_H__
00200 

SimData version pre-0.4.0. For more information on SimData, visit the SimData Homepage.

Generated on Tue Oct 14 12:06:38 2003, using Doxygen 1.2.18.

[SF.net]