HDF5BundleSaver.hpp

00001 
00002 //
00003 // $Id: HDF5Bundle.hpp,v 1.7 2007/10/24 04:45:26 werner Exp $
00004 //
00006 #ifndef __FIBER_HDF5BUNDLE_HPP
00007 #define __FIBER_HDF5BUNDLE_HPP "Created 27.02.2001 21:42:27 by werner"
00008 
00009 #include "FBhdf5API.h"
00010 #include "init.hpp"
00011 #include <bundle/Bundle.hpp>
00012 #include <memcore/Persistencer.hpp>
00013 
00014 #include "HDF5Saver.hpp"
00015 
00016 namespace Fiber
00017 {
00018         using std::list;
00019         using std::string;
00020         using namespace MemCore;
00021 
00025 template <>
00026 class   HDF5BUNDLE_API HDF5Saver<Bundle> : public Interface<HDF5>
00027 {
00028 public:
00029         void save(const Bundle&B, const char*filename, const RefPtr<StringList>&SaveableGridNames);
00030 
00031         bool apply_const(const Intercube&I, const RefPtr<InterfaceIterationParameter>&);
00032 };
00033 
00034 
00035 class   HDF5BUNDLE_API F5StreamSaver : public StreamSaverInterface
00036 {
00037 public:
00038         WeakPtr<Bundle> B;
00039 
00040         F5StreamSaver(const WeakPtr<Bundle>&Bndl)
00041         : B(Bndl)
00042         {}
00043 
00044         ~F5StreamSaver();
00045 
00046         override bool save(int socket);
00047 };
00048 
00049 
00052 template <>
00053 class   HDF5BUNDLE_API HDF5SaverCreator<Bundle> : public SaveInterfaceCreator<Bundle>
00054 {
00055 public:
00056         HDF5SaverCreator<Bundle>()
00057         : SaveInterfaceCreator<Bundle>("f5", "FiberBundle HDF5 (F5)")
00058         {}
00059 
00060         ~HDF5SaverCreator<Bundle>()
00061         {}
00062 
00063         override bool addSaveInterface(Bundle*B)
00064         {
00065                 B->addInterface( new HDF5Saver<Bundle>() ); 
00066 //#ifdef        H5_HAVE_STREAM
00067                 B->addInterface( new F5StreamSaver(B->self() ) ); 
00068 //#endif
00069                 return false;
00070         }
00071 };
00072 
00083 template <>
00084 class   HDF5BUNDLE_API HDF5Loader<Bundle> : public Loader<Bundle>
00085 {
00086         override RefPtr<Bundle> load(const RefPtr<LoaderParameters>&LP, const RefPtr<Bundle>&)
00087         {
00088                 return NullPtr();
00089         }
00090 };
00091 
00092 } /* namespace Fiber */ 
00093 
00094 #endif /* __FIBER_HDF5BUNDLE_HPP */
00095