Mercurial > hg > orthanc-databases
comparison Framework/Common/ResultFileValue.h @ 246:483af3f35a4b
turning ResultFileValue into a base class, and implement its primitives for PostgreSQL
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 14 Apr 2021 08:42:31 +0200 |
parents | 9d00e5e073e8 |
children | e57a5313ffe5 |
comparison
equal
deleted
inserted
replaced
245:9d00e5e073e8 | 246:483af3f35a4b |
---|---|
25 | 25 |
26 #include <Compatibility.h> | 26 #include <Compatibility.h> |
27 | 27 |
28 namespace OrthancDatabases | 28 namespace OrthancDatabases |
29 { | 29 { |
30 /** | |
31 * This class is not used for MySQL, as MySQL uses BLOB columns to | |
32 * store files. | |
33 **/ | |
30 class ResultFileValue : public IValue | 34 class ResultFileValue : public IValue |
31 { | 35 { |
32 private: | |
33 std::string content_; | |
34 | |
35 public: | 36 public: |
36 ResultFileValue() | 37 virtual void ReadWhole(std::string& target) const = 0; |
37 { | 38 |
38 } | 39 virtual void ReadRange(std::string& target, |
39 | 40 uint64_t start, |
40 std::string& GetContent() | 41 size_t length) const = 0; |
41 { | 42 |
42 return content_; | |
43 } | |
44 | |
45 const std::string& GetContent() const | |
46 { | |
47 return content_; | |
48 } | |
49 | |
50 const void* GetBuffer() const | |
51 { | |
52 return (content_.empty() ? NULL : content_.c_str()); | |
53 } | |
54 | |
55 size_t GetSize() const | |
56 { | |
57 return content_.size(); | |
58 } | |
59 | |
60 virtual ValueType GetType() const ORTHANC_OVERRIDE | 43 virtual ValueType GetType() const ORTHANC_OVERRIDE |
61 { | 44 { |
62 return ValueType_ResultFile; | 45 return ValueType_ResultFile; |
63 } | 46 } |
64 | 47 |