/* * StorageManager.h * * Copyright (C) 2009 Matthias Schiffer * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by the * Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along * with this program. If not, see . */ #ifndef MAD_COMMON_DATAMANAGER_H_ #define MAD_COMMON_DATAMANAGER_H_ #include "export.h" #include "XmlData.h" #include #include #include namespace Mad { namespace Common { class Application; class StorageBackend; class MAD_COMMON_EXPORT StorageManager { private: friend class Application; Application *application; boost::shared_ptr backend; boost::shared_mutex mutex; StorageManager(Application *application0) : application(application0) {} public: void setBackend(boost::shared_ptr newBackend); void unsetBackend(boost::shared_ptr oldBackend); std::set listTypes() throw (Core::Exception); std::set list(const Core::String &type) throw (Core::Exception); bool exists(const Core::String &type, const Core::String &name) throw (Core::Exception); void store(const Core::String &type, const Core::String &name, const XmlData *data) throw (Core::Exception); boost::shared_ptr load(const Core::String &type, const Core::String &name) throw (Core::Exception); void copy(const Core::String &type, const Core::String &name, const Core::String &newName) throw (Core::Exception); void rename(const Core::String &type, const Core::String &name, const Core::String &newName) throw (Core::Exception); void remove(const Core::String &type, const Core::String &name) throw (Core::Exception); }; } } #endif /* MAD_COMMON_DATAMANAGER_H_ */