FishSaver.hpp

00001 #ifndef __FISH_BONE_FISHSAVER_HPP
00002 #define __FISH_BONE_FISHSAVER_HPP
00003 
00004 #include "fishboneDllApi.h"
00005 #include <ocean/plankton/VObject.hpp>
00006 #include <bundle/Bundle.hpp>
00007 #include "FishGrid.hpp"
00008 
00009 using namespace Fiber;
00010 
00011 namespace Wizt
00012 {
00013 
00014 class   fishbone_API FishSavable;
00015 class   fishbone_API FishSaver;
00016 
00020 struct  fishbone_API FishBait
00021 {
00022         BundlePtr          Spacetime;
00023         RefPtr<StringList> SaveableGridNames; 
00024 
00025         FishBait()
00026         {} 
00027 
00028         FishBait(const BundlePtr&theSpacetime)
00029         : Spacetime(theSpacetime)
00030         {} 
00031 
00032         FishBait(const BundlePtr&theSpacetime, const string&WhichGrid)
00033         : Spacetime(theSpacetime)
00034         {
00035                 if (WhichGrid.length()>0)
00036                         SaveableGridNames = new StringList(WhichGrid);
00037         }
00038 
00039         ~FishBait();
00040 };
00041 
00051 class   fishbone_API FishWharf : public ReferenceBase<FishWharf>
00052 {
00053         FishSavable&MySaveable;
00054 
00055         FishWharf(const FishWharf&);
00056         void operator=(const FishWharf&);
00057 
00058 public: 
00060         FishWharf(FishSavable&MySaveable); 
00061 
00063         virtual ~FishWharf(); 
00064 
00066         FishBait getBait() const;
00067 };
00068 
00069 
00077 class   fishbone_API FishSavable
00078 {
00079         MemCore::RefPtr<FishWharf> MyFishWharf; 
00080 
00081         FishSavable(const FishSavable&);
00082         void operator=(const FishSavable&); 
00083 
00084         friend class FishSaver;
00085 
00086 public: 
00091         FishSavable(VSaveable*what);
00092 
00093         virtual ~FishSavable() = 0; 
00094 
00099         virtual FishBait getBait() const = 0;
00100 };
00101 
00102 inline  FishBait FishWharf::getBait() const
00103 {
00104         return MySaveable.getBait();
00105 }
00106 
00109 class   fishbone_API FishSaver : public VishSaver
00110 {
00111         WeakPtr<FishWharf>      MyFishWharf;
00112 public: 
00113 
00114         FishSaver(const FishSavable&FS); 
00115 
00116         bool save(const string&url);
00117 };
00118 
00119 
00126 class   fishbone_API FishGridSavable : public FishSavable
00127 {
00128         VOutput<Grid>           &MySavableGrid;
00129 
00130 public: 
00143         FishGridSavable(VSaveable*what, VOutput<Grid>&SavableGrid)
00144         : FishSavable(what)
00145         , MySavableGrid(SavableGrid)
00146         {} 
00147 
00154         override FishBait getBait() const;
00155 
00156         ~FishGridSavable();
00157 };
00158 
00159 #define F5_SAVER_NAME "FiberBundle HDF5 (F5)"
00160 
00161 
00162 } // Wizt
00163 
00164 
00165 #endif // __FISH_BONE_FISHSAVER_HPP
00166