Mercurial > hg > orthanc
comparison OrthancServer/Sources/Database/FindResponse.h @ 5748:4bc650d88463 find-refactoring
WIP: started to implement IntegratedFind in SQLite
author | Alain Mazy <am@orthanc.team> |
---|---|
date | Fri, 30 Aug 2024 18:03:37 +0200 |
parents | 708952bd869c |
children | 093a8693ba16 |
comparison
equal
deleted
inserted
replaced
5747:796cb17db15c | 5748:4bc650d88463 |
---|---|
278 void DebugExport(Json::Value& target, | 278 void DebugExport(Json::Value& target, |
279 const FindRequest& request) const; | 279 const FindRequest& request) const; |
280 }; | 280 }; |
281 | 281 |
282 private: | 282 private: |
283 typedef std::map<std::string, Resource*> Index; | 283 typedef std::map<std::string, Resource*> IdentifierIndex; |
284 typedef std::map<int64_t, Resource*> InternalIdIndex; | |
284 | 285 |
285 std::deque<Resource*> items_; | 286 std::deque<Resource*> items_; |
286 Index index_; | 287 IdentifierIndex identifierIndex_; |
288 InternalIdIndex internalIdIndex_; | |
287 | 289 |
288 public: | 290 public: |
289 ~FindResponse(); | 291 ~FindResponse(); |
290 | 292 |
291 void Add(Resource* item /* takes ownership */); | 293 void Add(Resource* item /* takes ownership */); |
297 | 299 |
298 const Resource& GetResourceByIndex(size_t index) const; | 300 const Resource& GetResourceByIndex(size_t index) const; |
299 | 301 |
300 Resource& GetResourceByIdentifier(const std::string& id); | 302 Resource& GetResourceByIdentifier(const std::string& id); |
301 | 303 |
304 Resource& GetResourceByInternalId(int64_t internalId); | |
305 | |
302 const Resource& GetResourceByIdentifier(const std::string& id) const | 306 const Resource& GetResourceByIdentifier(const std::string& id) const |
303 { | 307 { |
304 return const_cast<FindResponse&>(*this).GetResourceByIdentifier(id); | 308 return const_cast<FindResponse&>(*this).GetResourceByIdentifier(id); |
305 } | 309 } |
306 | 310 |
311 const Resource& GetResourceByInternalId(int64_t internalId) const | |
312 { | |
313 return const_cast<FindResponse&>(*this).GetResourceByInternalId(internalId); | |
314 } | |
315 | |
307 bool HasResource(const std::string& id) const | 316 bool HasResource(const std::string& id) const |
308 { | 317 { |
309 return (index_.find(id) != index_.end()); | 318 return (identifierIndex_.find(id) != identifierIndex_.end()); |
319 } | |
320 | |
321 bool HasResource(int64_t& internalId) const | |
322 { | |
323 return (internalIdIndex_.find(internalId) != internalIdIndex_.end()); | |
310 } | 324 } |
311 }; | 325 }; |
312 } | 326 } |