Asylo
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
asylo::primitives::PrimitiveStatus Class Reference

Shared representation of a status code across the enclave boundary. More...

#include <asylo/platform/primitives/primitive_status.h>

Public Member Functions

 PrimitiveStatus ()
 Builds an OK status. More...
 
 PrimitiveStatus (int code)
 Builds a status with an error code and an empty message. More...
 
 PrimitiveStatus (int code, const char *message)
 Builds a status with an error code and error message. More...
 
 PrimitiveStatus (int code, const char *message, size_t message_size)
 Builds a status with an error code and a message of size message_size. More...
 
 PrimitiveStatus (int code, const std::string &message)
 Builds a status with an error code and a message in string format. More...
 
 PrimitiveStatus (const PrimitiveStatus &other)
 Copy constructor. More...
 
PrimitiveStatusoperator= (const PrimitiveStatus &other)
 
int error_code () const
 Getter for this object's error code. More...
 
const char * error_message () const
 Getter for this object's error message. More...
 
bool ok () const
 Predicate for non-error status. More...
 

Static Public Member Functions

static PrimitiveStatus OkStatus ()
 PrimitiveStatus::OkStatus() is the canonical name for an OK status. More...
 

Static Public Attributes

static constexpr size_t kMessageMax = 1024
 Maximum error string length in characters. More...
 

Detailed Description

Shared representation of a status code across the enclave boundary.

PrimitiveStatus does not include an error space and always refers to a google::GoogleError value.

Constructor & Destructor Documentation

◆ PrimitiveStatus() [1/6]

asylo::primitives::PrimitiveStatus::PrimitiveStatus ( )
inline

Builds an OK status.

◆ PrimitiveStatus() [2/6]

asylo::primitives::PrimitiveStatus::PrimitiveStatus ( int  code)
inlineexplicit

Builds a status with an error code and an empty message.

Parameters
codeAn error code that is interpreted as a google::GoogleError value.

◆ PrimitiveStatus() [3/6]

asylo::primitives::PrimitiveStatus::PrimitiveStatus ( int  code,
const char *  message 
)
inline

Builds a status with an error code and error message.

Parameters
codeAn error code that is interpreted as a google::GoogleError value.
messageA message string that is truncated if longer than kMessageMax - 1 characters. The length is computed with strlen.

◆ PrimitiveStatus() [4/6]

asylo::primitives::PrimitiveStatus::PrimitiveStatus ( int  code,
const char *  message,
size_t  message_size 
)
inline

Builds a status with an error code and a message of size message_size.

Parameters
codeAn error code that is interpreted as a google::GoogleError value.
messageA message string that is truncated if longer than kMessageMax - 1 characters.
message_sizeThe size of the message to copy, which will not exceed kMessageMax - 1 characters.

◆ PrimitiveStatus() [5/6]

asylo::primitives::PrimitiveStatus::PrimitiveStatus ( int  code,
const std::string &  message 
)
inline

Builds a status with an error code and a message in string format.

◆ PrimitiveStatus() [6/6]

asylo::primitives::PrimitiveStatus::PrimitiveStatus ( const PrimitiveStatus other)
inline

Copy constructor.

Parameters
otherThe status to copy. Strings are memcpy'd.

Member Function Documentation

◆ error_code()

int asylo::primitives::PrimitiveStatus::error_code ( ) const
inline

Getter for this object's error code.

Returns
The integer error code for this object.

◆ error_message()

const char* asylo::primitives::PrimitiveStatus::error_message ( ) const
inline

Getter for this object's error message.

returns The string error message for this object.

◆ ok()

bool asylo::primitives::PrimitiveStatus::ok ( ) const
inline

Predicate for non-error status.

Returns
True if and only if this object is OK (indicates no error).

◆ OkStatus()

static PrimitiveStatus asylo::primitives::PrimitiveStatus::OkStatus ( )
inlinestatic

PrimitiveStatus::OkStatus() is the canonical name for an OK status.

Returns
An OK status object.

◆ operator=()

PrimitiveStatus& asylo::primitives::PrimitiveStatus::operator= ( const PrimitiveStatus other)
inline

Member Data Documentation

◆ kMessageMax

constexpr size_t asylo::primitives::PrimitiveStatus::kMessageMax = 1024
static

Maximum error string length in characters.


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