Mercurial > hg > orthanc
comparison Core/FileStorage/MemoryStorageArea.cpp @ 2826:c277e0421200
unit testing of overwriting
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 19 Sep 2018 16:06:41 +0200 |
parents | d7815540bd81 |
children | 4e43e67f8ecf |
comparison
equal
deleted
inserted
replaced
2825:8aa6aef11b70 | 2826:c277e0421200 |
---|---|
33 | 33 |
34 #include "../PrecompiledHeaders.h" | 34 #include "../PrecompiledHeaders.h" |
35 #include "MemoryStorageArea.h" | 35 #include "MemoryStorageArea.h" |
36 | 36 |
37 #include "../OrthancException.h" | 37 #include "../OrthancException.h" |
38 #include "../Logging.h" | |
38 | 39 |
39 namespace Orthanc | 40 namespace Orthanc |
40 { | 41 { |
41 MemoryStorageArea::~MemoryStorageArea() | 42 MemoryStorageArea::~MemoryStorageArea() |
42 { | 43 { |
52 void MemoryStorageArea::Create(const std::string& uuid, | 53 void MemoryStorageArea::Create(const std::string& uuid, |
53 const void* content, | 54 const void* content, |
54 size_t size, | 55 size_t size, |
55 FileContentType type) | 56 FileContentType type) |
56 { | 57 { |
58 LOG(INFO) << "Creating attachment \"" << uuid << "\" of \"" << static_cast<int>(type) | |
59 << "\" type (size: " << (size / (1024 * 1024) + 1) << "MB)"; | |
60 | |
57 boost::mutex::scoped_lock lock(mutex_); | 61 boost::mutex::scoped_lock lock(mutex_); |
58 | 62 |
59 if (size != 0 && | 63 if (size != 0 && |
60 content == NULL) | 64 content == NULL) |
61 { | 65 { |
74 | 78 |
75 void MemoryStorageArea::Read(std::string& content, | 79 void MemoryStorageArea::Read(std::string& content, |
76 const std::string& uuid, | 80 const std::string& uuid, |
77 FileContentType type) | 81 FileContentType type) |
78 { | 82 { |
83 LOG(INFO) << "Reading attachment \"" << uuid << "\" of \"" | |
84 << static_cast<int>(type) << "\" content type"; | |
85 | |
79 boost::mutex::scoped_lock lock(mutex_); | 86 boost::mutex::scoped_lock lock(mutex_); |
80 | 87 |
81 Content::const_iterator found = content_.find(uuid); | 88 Content::const_iterator found = content_.find(uuid); |
82 | 89 |
83 if (found == content_.end()) | 90 if (found == content_.end()) |
96 | 103 |
97 | 104 |
98 void MemoryStorageArea::Remove(const std::string& uuid, | 105 void MemoryStorageArea::Remove(const std::string& uuid, |
99 FileContentType type) | 106 FileContentType type) |
100 { | 107 { |
108 LOG(INFO) << "Deleting attachment \"" << uuid << "\" of type " << static_cast<int>(type); | |
109 | |
101 boost::mutex::scoped_lock lock(mutex_); | 110 boost::mutex::scoped_lock lock(mutex_); |
102 | 111 |
103 Content::iterator found = content_.find(uuid); | 112 Content::iterator found = content_.find(uuid); |
104 | 113 |
105 if (found == content_.end()) | 114 if (found == content_.end()) |