22 #ifndef NDN_CONTROL_RESPONSE_HPP
23 #define NDN_CONTROL_RESPONSE_HPP
25 #include "control-parameters.hpp"
26 #include "encoding/wire-format.hpp"
27 #include "lite/control-response-lite.hpp"
52 : statusCode_(controlResponse.statusCode_),
53 statusText_(controlResponse.statusText_)
55 if (controlResponse.bodyAsControlParameters_)
56 bodyAsControlParameters_.reset
69 return wireFormat.encodeControlResponse(*
this);
82 (
const uint8_t *input,
size_t inputLength,
85 wireFormat.decodeControlResponse(*
this, input, inputLength);
97 (
const std::vector<uint8_t>& input,
100 wireDecode(&input[0], input.size(), wireFormat);
167 statusCode_ = statusCode;
179 statusText_ = statusText;
193 if (controlParameters)
194 bodyAsControlParameters_.reset
197 bodyAsControlParameters_.reset();
203 std::string statusText_;
204 ptr_lib::shared_ptr<ControlParameters> bodyAsControlParameters_;
ControlResponse(const ControlResponse &controlResponse)
Create a new ControlResponse as a deep copy of the given ControlResponse.
Definition: control-response.hpp:51
Copyright (C) 2013-2016 Regents of the University of California.
Definition: common.hpp:35
A ControlResponseLite holds a status code, status text and other fields for a ControlResponse which i...
Definition: control-response-lite.hpp:35
A ControlResponse holds a status code, status text and other fields for a ControlResponse which is us...
Definition: control-response.hpp:37
ControlResponse & setBodyAsControlParameters(const ControlParameters *controlParameters)
Set the control response body as a ControlParameters.
Definition: control-response.hpp:191
A ControlParameters holds a Name and other fields for a ControlParameters which is used...
Definition: control-parameters.hpp:37
int getStatusCode() const
Get the status code.
Definition: control-response.hpp:142
ControlResponse()
Create a new ControlResponse where all values are unspecified.
Definition: control-response.hpp:42
A Blob holds a pointer to an immutable byte array implemented as const std::vector.
Definition: blob.hpp:42
ControlResponse & setStatusText(const std::string &statusText)
Set the status text.
Definition: control-response.hpp:177
const uint8_t * buf() const
Return a const pointer to the first byte of the immutable byte array, or 0 if the pointer is null...
Definition: blob.hpp:159
const std::string & getStatusText() const
Get the status text.
Definition: control-response.hpp:149
size_t size() const
Return the length of the immutable byte array.
Definition: blob.hpp:147
void set(const ControlResponseLite &controlResponseLite)
Clear this ControlResponse, and set the values by copying from controlResponseLite.
Definition: control-response.cpp:44
ControlResponse & setStatusCode(int statusCode)
Set the status code.
Definition: control-response.hpp:165
const ControlParameters * getBodyAsControlParameters() const
Get the control response body as a ControlParameters.
Definition: control-response.hpp:157
Blob wireEncode(WireFormat &wireFormat=*WireFormat::getDefaultWireFormat()) const
Encode this ControlResponse for a particular wire format.
Definition: control-response.hpp:67
void wireDecode(const uint8_t *input, size_t inputLength, WireFormat &wireFormat=*WireFormat::getDefaultWireFormat())
Decode the input using a particular wire format and update this ControlResponse.
Definition: control-response.hpp:82