Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Related Pages

IOManager.h

00001 #ifndef SCT_IOMANAGER_H
00002 #define SCT_IOMANAGER_H
00003 
00004 #include "IoExceptions.h"
00005 #include <map>
00006 #include <boost/shared_ptr.hpp>
00007 #include <boost/utility.hpp>
00008 
00009 using std::map;
00010 using boost::shared_ptr;
00011 
00012 namespace Sct {
00013 
00014 class Streamer;
00015 class Streamable;
00016 class Serializable;
00017 class OStream;
00018 class IStream;
00019 
00024 class IOParams {
00025 public:
00026     virtual ~IOParams(){}
00027 };
00028 
00043 class IOManager : private boost::noncopyable {
00044 public:
00045     virtual ~IOManager() {};
00046     
00049 
00056     virtual void write(const Serializable& ob, const IOParams* params = 0) const = 0;
00057 
00064     virtual shared_ptr<Serializable> read(const string& name, const IOParams* params = 0) const = 0;
00066 
00067 
00068     //{
00071 
00079     virtual void writeImpl(OStream& out, const Streamable& ob, bool writeClassName) const ;
00080 
00088     virtual void writeImpl(OStream& out, const Streamable& ob, const string& className) const ;
00089     
00091     virtual void writeImpl(OStream& out, const Streamable& ob, const char* className) const ;
00092 
00100     virtual shared_ptr<Streamable> readImpl(IStream& in) const;
00101 
00110     virtual shared_ptr<Streamable> readImpl(IStream& in, const string& className) const;
00114     virtual shared_ptr<Streamable> readImpl(IStream& in, const char* className) const;
00115 
00123     virtual void readImpl(IStream& in, Streamable& ob, bool readClassName) const;
00124 
00132     virtual void readImpl(IStream& in, Streamable& ob, const string& className) const;
00133     
00135     virtual void readImpl(IStream& in, Streamable& ob, const char* className) const;
00136 
00145     virtual void writeClassName(OStream& out, const string& className) const;
00146     
00155     virtual string readClassName(IStream& in) const;    
00156     
00163     static bool addToMap(const std::string& className, std::auto_ptr<Streamer> s) throw();
00164 
00165 
00166     //}
00167 protected:
00168     //{
00170     
00177     virtual Streamer& getStreamer(const string& className) const;
00183     virtual Streamer& getStreamer(const string& className, const unsigned version) const;
00184     //}
00185     typedef map<string, shared_ptr<Streamer> > StreamerMap;
00186     static StreamerMap& getMap() throw(); 
00187     static StreamerMap& getFullVersionMap() throw(); 
00188     static std::string getMapName(const std::string& classname, const unsigned version) throw();
00189     friend class Streamer;
00190 };
00191 
00192 }
00193 
00194 #endif //SCT_IOMANAGER_H

Generated on Thu Jul 15 09:50:46 2004 for SCT DAQ/DCS Software - C++ by doxygen 1.3.5