Mercurial > hg > orthanc-databases
comparison Framework/Plugins/StorageBackend.h @ 255:d663d9e44f8d
reintroduction of IDatabaseFactory into DatabaseManager
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 14 Apr 2021 17:57:08 +0200 |
parents | 33fa478c119a |
children | 567761f0c1ea |
comparison
equal
deleted
inserted
replaced
254:8a4ce70f456a | 255:d663d9e44f8d |
---|---|
72 }; | 72 }; |
73 | 73 |
74 private: | 74 private: |
75 class StringVisitor; | 75 class StringVisitor; |
76 | 76 |
77 boost::mutex mutex_; | 77 boost::mutex mutex_; |
78 std::unique_ptr<DatabaseManager> manager_; | 78 DatabaseManager manager_; |
79 | 79 |
80 DatabaseManager& GetManager(); | |
81 | |
82 protected: | 80 protected: |
83 class AccessorBase : public IAccessor | 81 class AccessorBase : public IAccessor |
84 { | 82 { |
85 private: | 83 private: |
86 boost::mutex::scoped_lock lock_; | 84 boost::mutex::scoped_lock lock_; |
87 DatabaseManager& manager_; | 85 DatabaseManager& manager_; |
88 | 86 |
89 public: | 87 public: |
90 explicit AccessorBase(StorageBackend& backend) : | 88 explicit AccessorBase(StorageBackend& backend) : |
91 lock_(backend.mutex_), | 89 lock_(backend.mutex_), |
92 manager_(backend.GetManager()) | 90 manager_(backend.manager_) |
93 { | 91 { |
94 } | 92 } |
95 | 93 |
96 DatabaseManager& GetManager() const | 94 DatabaseManager& GetManager() const |
97 { | 95 { |
115 | 113 |
116 virtual void Remove(const std::string& uuid, | 114 virtual void Remove(const std::string& uuid, |
117 OrthancPluginContentType type) ORTHANC_OVERRIDE; | 115 OrthancPluginContentType type) ORTHANC_OVERRIDE; |
118 }; | 116 }; |
119 | 117 |
120 void SetDatabase(IDatabase* database); // Takes ownership | |
121 | |
122 virtual bool HasReadRange() const = 0; | 118 virtual bool HasReadRange() const = 0; |
123 | 119 |
124 public: | 120 public: |
121 StorageBackend(IDatabaseFactory* factory); // Takes ownership | |
122 | |
125 virtual ~StorageBackend() | 123 virtual ~StorageBackend() |
126 { | 124 { |
127 } | 125 } |
128 | 126 |
129 virtual IAccessor* CreateAccessor() | 127 virtual IAccessor* CreateAccessor() |