00001 00006 #pragma once 00007 00008 #include <map> 00009 #include <string> 00010 00011 #include <boost/archive/xml_iarchive.hpp> 00012 #include <boost/archive/xml_oarchive.hpp> 00013 #include <boost/serialization/map.hpp> 00014 #include <boost/filesystem.hpp> 00015 00016 #include "TransferFunction.hpp" 00017 00018 #include "Tools/Exception.hpp" 00019 00021 00023 class PresetManager { 00024 friend class boost::serialization::access; 00025 00026 private: 00027 static PresetManager *instance; 00028 00029 std::map<std::string,Transferfunction> preset; 00030 00031 PresetManager(); 00032 00033 protected: 00034 00035 template<class Archive> 00036 void serialize(Archive & ar, const unsigned int version) 00037 { 00038 ar & BOOST_SERIALIZATION_NVP(preset); 00039 } 00040 00041 public: 00042 static PresetManager &getInstance(); 00043 00044 void add(const std::string &name, const Transferfunction &preset); 00045 void remove(const std::string &name); 00046 Transferfunction &getTransferfunction(const std::string &name); 00047 00048 bool exists(const std::string &name) const; 00049 00050 std::vector<std::string> getPresetNames(); 00051 00052 void load(); 00053 void save(); 00054 00055 const size_t size() const; 00056 };