Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

fileserver.h

Go to the documentation of this file.
00001 /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*-
00002 
00003    this file is part of rcssserver3D
00004    Fri May 9 2003
00005    Copyright (C) 2002,2003 Koblenz University
00006    Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group
00007    $Id: fileserver.h,v 1.6 2004/04/08 07:17:08 rollmark Exp $
00008 
00009    This program is free software; you can redistribute it and/or modify
00010    it under the terms of the GNU General Public License as published by
00011    the Free Software Foundation; version 2 of the License.
00012 
00013    This program is distributed in the hope that it will be useful,
00014    but WITHOUT ANY WARRANTY; without even the implied warranty of
00015    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016    GNU General Public License for more details.
00017 
00018    You should have received a copy of the GNU General Public License
00019    along with this program; if not, write to the Free Software
00020    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00021 
00022    FileServer - global interface for file system access
00023 
00024         HISTORY:
00025                 12.07.01 - MK
00026                         - Initial version
00027                 14.07.01 - MK
00028                         - ClassServer was added, so the FileServer doesn't manage the
00029                           file system factories anymore (only concrete file system instances)
00030                 11.10.01 - MK
00031                         - Made singleton functionality more secure
00032                 20.11.01 - AF
00033                         - added the priority of the file systems : LIFO
00034                         - added the information of the file system id and its path to every mounted file system
00035                         - prevented the odditity to mount a file system more than once
00036                         - added GetFirstFileSystem and
00037                         GetNextFileSystem to iterate through the
00038                         mounted file systems
00039                 26.01.02 - MR
00040                         - added ForEachFile
00041                 27.06.02 - MK
00042                         - converted this to the Zeitgeist framework
00043                 09.07.02 - MK
00044                         - converted this to the Kerosin framework
00045                 10.10.02 - MK
00046                         - back to Zeitgeist framework
00047 
00048         TODO:
00049 
00050         TOFIX:
00051 */
00052 #ifndef ZEITGEIST_FILESERVER_H
00053 #define ZEITGEIST_FILESERVER_H
00054 
00055 #include <list>
00056 #include <zeitgeist/node.h>
00057 #include "filesystem.h"
00058 
00059 namespace zeitgeist
00060 {
00061 
00081 class FileServer : public Node
00082 {
00083     //
00084     // functions
00085     //
00086 public:
00087     typedef int THandle;
00088 
00089 protected:
00090     typedef std::map<THandle, boost::shared_ptr<salt::RFile> > TFileMap;
00091 
00092 public:
00094     FileServer();
00095     ~FileServer();
00096 
00103     boost::shared_ptr<salt::RFile> Open(const std::string& inName);
00104 
00108     THandle Register(const std::string& inName);
00109 
00112     boost::shared_ptr<salt::RFile> Get(THandle handle) const;
00113 
00116     void Close(THandle handle);
00117 
00119     bool Exist(const std::string& inName);
00120 
00129     bool Mount(const std::string& inFileSysName, const std::string& inPath);
00130 
00135     bool Unmount(const std::string& inPath);
00136 
00140     bool Unmount(const std::string& inClass, const std::string& inPath);
00141 
00151     int ForEachFile(const std::string& directory, const std::string& name,
00152                     const std::string& extension,
00153                     FileSystem::TCallback callback, void* param);
00154 
00155 protected:
00159     virtual void OnUnlink();
00160 
00161 private:
00162     FileServer(const FileServer&);
00163     FileServer& operator=(const FileServer&);
00164 
00165 protected:
00167     TFileMap mFileMap;
00168 
00170     THandle mNextHandle;
00171 };
00172 
00173 DECLARE_CLASS(FileServer)
00174 
00175 } //namespace zeitgeist
00176 
00177 #endif //ZEITGEIST_FILESERVER_H

Generated on Thu Apr 6 15:25:37 2006 for rcssserver3d by  doxygen 1.4.4