From d0cc9153d53dd4bc8dadf8bbcbe4ac72dfbbb61e Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 20 Sep 2009 16:03:35 +0200 Subject: Extended StorageManager to provide copy and remove methods. --- src/Common/StorageBackend.h | 2 ++ src/Common/StorageManager.cpp | 16 ++++++++++++++++ src/Common/StorageManager.h | 2 ++ 3 files changed, 20 insertions(+) (limited to 'src/Common') diff --git a/src/Common/StorageBackend.h b/src/Common/StorageBackend.h index abec185..24bb437 100644 --- a/src/Common/StorageBackend.h +++ b/src/Common/StorageBackend.h @@ -45,6 +45,8 @@ class StorageBackend { virtual void store(const std::string &type, const std::string &name, const XmlData *data) throw (Core::Exception) = 0; virtual boost::shared_ptr load(const std::string &type, const std::string &name) throw (Core::Exception) = 0; + virtual void copy(const std::string &type, const std::string &name, const std::string &newName) throw (Core::Exception) = 0; + virtual void rename(const std::string &type, const std::string &name, const std::string &newName) throw (Core::Exception) = 0; virtual void remove(const std::string &type, const std::string &name) throw (Core::Exception) = 0; public: diff --git a/src/Common/StorageManager.cpp b/src/Common/StorageManager.cpp index 3b14554..5b5fc65 100644 --- a/src/Common/StorageManager.cpp +++ b/src/Common/StorageManager.cpp @@ -76,6 +76,22 @@ boost::shared_ptr StorageManager::load(const std::string &type, const s return backend->load(type, name); } +void StorageManager::copy(const std::string &type, const std::string &name, const std::string &newName) throw (Core::Exception) { + boost::shared_lock lock(mutex); + if(!backend) + throw Core::Exception(Core::Exception::NOT_IMPLEMENTED); + + backend->copy(type, name, newName); +} + +void StorageManager::rename(const std::string &type, const std::string &name, const std::string &newName) throw (Core::Exception) { + boost::shared_lock lock(mutex); + if(!backend) + throw Core::Exception(Core::Exception::NOT_IMPLEMENTED); + + backend->rename(type, name, newName); +} + void StorageManager::remove(const std::string &type, const std::string &name) throw (Core::Exception) { boost::shared_lock lock(mutex); if(!backend) diff --git a/src/Common/StorageManager.h b/src/Common/StorageManager.h index 594c294..d6cb5f5 100644 --- a/src/Common/StorageManager.h +++ b/src/Common/StorageManager.h @@ -59,6 +59,8 @@ class MAD_COMMON_EXPORT StorageManager { void store(const std::string &type, const std::string &name, const XmlData *data) throw (Core::Exception); boost::shared_ptr load(const std::string &type, const std::string &name) throw (Core::Exception); + void copy(const std::string &type, const std::string &name, const std::string &newName) throw (Core::Exception); + void rename(const std::string &type, const std::string &name, const std::string &newName) throw (Core::Exception); void remove(const std::string &type, const std::string &name) throw (Core::Exception); }; -- cgit v1.2.3