Go to the documentation of this file.00001 #ifndef MEGATREE_VIZ_STORAGE_H_
00002 #define MEGATREE_VIZ_STORAGE_H_
00003
00004 #include <megatree/storage.h>
00005 #include <cstdio>
00006
00007 namespace megatree
00008 {
00009 class VizStorage : public Storage
00010 {
00011 public:
00012 VizStorage(const boost::filesystem::path &path);
00013 ~VizStorage() {}
00014
00015 virtual void get(const boost::filesystem::path &path, ByteVec &result);
00016 virtual void getBatch(const std::vector<boost::filesystem::path> &paths, std::vector<ByteVec> &results);
00017 virtual void getAsync(const boost::filesystem::path &path, GetCallback callback);
00018
00019
00020 virtual std::string getType() {return std::string("VizStorage"); };
00021
00022
00023 virtual void putBatch(const std::vector<boost::filesystem::path> &paths, std::vector<ByteVec> &data)
00024 {printf("VizStorage does not support writing"); abort();};
00025 virtual void putAsync(const boost::filesystem::path &path, const ByteVec& data, PutCallback callback)
00026 {printf("VizStorage does not support writing"); abort();};
00027
00028
00029 private:
00030 boost::filesystem::path tree;
00031 boost::shared_ptr<Storage> storage;
00032 unsigned subtree_width;
00033
00034 void convert(const ByteVec& data_in, ByteVec& data_out);
00035 void convertCb(const boost::filesystem::path &path, GetCallback cb, const ByteVec& data);
00036 };
00037
00038 }
00039 #endif