blob: 7fa3deec3dde11725cd8e8494e8f1ba73720daf3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include "documentacceptedreply.h"
namespace document { class Document; }
namespace documentapi {
class GetDocumentReply : public DocumentAcceptedReply {
private:
using DocumentSP = std::shared_ptr<document::Document>;
DocumentSP _document;
uint64_t _lastModified;
public:
/**
* Convenience typedef.
*/
using UP = std::unique_ptr<GetDocumentReply>;
using SP = std::shared_ptr<GetDocumentReply>;
/**
* Constructs a new reply for deserialization.
*/
GetDocumentReply();
~GetDocumentReply();
/**
* Constructs a new document get reply.
*
* @param document The document requested.
*/
GetDocumentReply(DocumentSP document);
/**
* Returns the document retrieved.
*
* @return The document.
*/
const document::Document & getDocument() const { return *_document; }
bool hasDocument() const { return _document.get() != nullptr; }
/**
* Sets the document retrieved.
*
* @param document The document.
*/
void setDocument(DocumentSP document);
/**
* Returns the date the document was last modified.
*
* @return The date.
*/
uint64_t getLastModified() const { return _lastModified; };
/**
* Set the date the document was last modified.
*
* @param lastModified The date.
*/
void setLastModified(uint64_t lastModified) { _lastModified = lastModified; }
string toString() const override { return "getdocumentreply"; }
};
}
|