Public Member Functions | Static Public Member Functions | Friends | List of all members
ndn::ControlResponseLite Class Reference

A ControlResponseLite holds a status code, status text and other fields for a ControlResponse which is used, for example, in the response from sending a register prefix control command to a forwarder. More...

#include <control-response-lite.hpp>

Inheritance diagram for ndn::ControlResponseLite:
ndn_ControlResponse

Public Member Functions

 ControlResponseLite (struct ndn_NameComponent *nameComponents, size_t maxNameComponents, struct ndn_NameComponent *strategyNameComponents, size_t strategyMaxNameComponents)
 Create a ControlResponseLite to use the pre-allocated nameComponents and strategyNameComponents for the ControlParameters, and with default field values. More...
 
int getStatusCode () const
 
const BlobLitegetStatusText () const
 
bool getHasBodyAsControlParameters () const
 Check if the bodyAsControlParameters is specified. More...
 
ControlParametersLitegetBodyAsControlParameters ()
 Get the bodyAsControlParameters, if specified. More...
 
const ControlParametersLitegetBodyAsControlParameters () const
 
void setHasBodyAsControlParameters (bool hasBodyAsControlParameters)
 Set the flag for whether the bodyAsControlParameters is specified. More...
 
ndn_Error setBodyAsControlParameters (const ControlParametersLite &bodyAsControlParameters)
 Set the bodyAsControlParameters to have the values from the given control parameters. More...
 
ControlResponseLitesetStatusCode (int statusCode)
 Set the status code. More...
 
ControlResponseLitesetStatusText (const BlobLite &statusText)
 Set status text. More...
 

Static Public Member Functions

static ControlResponseLitedownCast (ndn_ControlResponse &controlResponse)
 Downcast the reference to the ndn_ControlResponse struct to a ControlResponseLite. More...
 
static const ControlResponseLitedownCast (const ndn_ControlResponse &controlResponse)
 

Friends

class Tlv0_1_1WireFormatLite
 

Detailed Description

A ControlResponseLite holds a status code, status text and other fields for a ControlResponse which is used, for example, in the response from sending a register prefix control command to a forwarder.

Constructor & Destructor Documentation

ndn::ControlResponseLite::ControlResponseLite ( struct ndn_NameComponent * nameComponents  ,
size_t  maxNameComponents,
struct ndn_NameComponent * strategyNameComponents  ,
size_t  strategyMaxNameComponents 
)

Create a ControlResponseLite to use the pre-allocated nameComponents and strategyNameComponents for the ControlParameters, and with default field values.

Parameters
nameComponentsThe pre-allocated array of ndn_NameComponent for the main name. Instead of an array of NameLite::Component, this is an array of the underlying ndn_NameComponent struct so that it doesn't run the default constructor unnecessarily.
maxNameComponentsThe number of elements in the allocated nameComponents array.
strategyNameComponentsThe pre-allocated array of ndn_NameComponent for the strategy name. Instead of an array of NameLite::Component, this is an array of the underlying ndn_NameComponent struct so that it doesn't run the default constructor unnecessarily.
strategyMaxNameComponentsThe number of elements in the allocated strategyNameComponents array.

Member Function Documentation

static ControlResponseLite& ndn::ControlResponseLite::downCast ( ndn_ControlResponse controlResponse)
inlinestatic

Downcast the reference to the ndn_ControlResponse struct to a ControlResponseLite.

Parameters
controlResponseA reference to the ndn_ControlResponse struct.
Returns
The same reference as ControlResponseLite.
ControlParametersLite& ndn::ControlResponseLite::getBodyAsControlParameters ( )
inline

Get the bodyAsControlParameters, if specified.

Returns
The bodyAsControlParameters. This is only meaningful if getHasName() is true.
bool ndn::ControlResponseLite::getHasBodyAsControlParameters ( ) const
inline

Check if the bodyAsControlParameters is specified.

Returns
True if the bodyAsControlParameters is specified, false if not.
ndn_Error ndn::ControlResponseLite::setBodyAsControlParameters ( const ControlParametersLite bodyAsControlParameters)
inline

Set the bodyAsControlParameters to have the values from the given control parameters.

This also calls setHasBodyAsControlParameters(true).

Parameters
bodyAsControlParametersThe control parameters to get values from. If the bodyAsControlParameters is not specified, call setBodyAsControlParameters(false).
Returns
0 for success, or an error code if there is not enough room in this object's name components array.
void ndn::ControlResponseLite::setHasBodyAsControlParameters ( bool  hasBodyAsControlParameters)
inline

Set the flag for whether the bodyAsControlParameters is specified.

Note that setBodyAsControlParameters automatically calls setHasName(true).

Parameters
hasBodyAsControlParametersTrue if the bodyAsControlParameters is specified, false if not.
ControlResponseLite& ndn::ControlResponseLite::setStatusCode ( int  statusCode)
inline

Set the status code.

Parameters
statusCodeThe new status code, or -1 for not specified.
Returns
This ControlResponseLite so that you can chain calls to update values.
ControlResponseLite& ndn::ControlResponseLite::setStatusText ( const BlobLite statusText)
inline

Set status text.

Parameters
statusTextThe new status text, or an empty string for not specified.
Returns
This ControlResponseLite so that you can chain calls to update values.

The documentation for this class was generated from the following files: