0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
Hypertable::Status Class Reference

Holds Nagios-style program status information. More...

#include <Status.h>

Inheritance diagram for Hypertable::Status:
Inheritance graph
[legend]
Collaboration diagram for Hypertable::Status:
Collaboration graph
[legend]

Classes

class  Text
 Status text string constants. More...
 

Public Types

enum  Code : int32_t { Code::OK = 0, Code::WARNING = 1, Code::CRITICAL = 2, Code::UNKNOWN = 3 }
 Enumeration for status codes. More...
 

Public Member Functions

 Status ()
 Constructor. More...
 
 Status (Code code, const std::string &text)
 Constructor with initial values. More...
 
 Status (const Status &other)
 Copy constructor. More...
 
Statusoperator= (const Status &rhs)
 Copy assignment operator. More...
 
void set (Code code, const std::string &text)
 Sets status code and text. More...
 
void get (Code *code, std::string &text) const
 Gets status code and text. More...
 
Code get ()
 Gets status code. More...
 
std::string format_output_line (const std::string &service)
 Formats a Nagios-style output line. More...
 
- Public Member Functions inherited from Hypertable::Serializable
virtual size_t encoded_length () const
 Returns serialized object length. More...
 
virtual void encode (uint8_t **bufp) const
 Writes serialized representation of object to a buffer. More...
 
virtual void decode (const uint8_t **bufp, size_t *remainp)
 Reads serialized representation of object from a buffer. More...
 

Static Public Member Functions

static const char * code_to_string (Code code)
 
static Code string_to_code (std::string str)
 

Private Member Functions

uint8_t encoding_version () const override
 Returns encoding version. More...
 
size_t encoded_length_internal () const override
 Returns internal serialized length. More...
 
void encode_internal (uint8_t **bufp) const override
 Writes serialized representation of object to a buffer. More...
 
void decode_internal (uint8_t version, const uint8_t **bufp, size_t *remainp) override
 Reads serialized representation of object from a buffer. More...
 

Private Attributes

std::mutex m_mutex
 Mutex for serializaing access to members More...
 
Code m_code
 Status code. More...
 
std::string m_text
 Status text. More...
 

Additional Inherited Members

Detailed Description

Holds Nagios-style program status information.

Definition at line 42 of file Status.h.

Constructor & Destructor Documentation

Hypertable::Status::Status ( )
inline

Constructor.

Definition at line 70 of file Status.h.

Hypertable::Status::Status ( Code  code,
const std::string &  text 
)
inline

Constructor with initial values.

Parameters
codeStatus code
textStatus text

Definition at line 75 of file Status.h.

Hypertable::Status::Status ( const Status other)
inline

Copy constructor.

Parameters
otherOther status object from which to copy

Definition at line 79 of file Status.h.

Member Function Documentation

const char * Status::code_to_string ( Code  code)
static

Definition at line 39 of file Status.cc.

void Status::decode_internal ( uint8_t  version,
const uint8_t **  bufp,
size_t *  remainp 
)
overrideprivatevirtual

Reads serialized representation of object from a buffer.

Parameters
versionEncoding version
bufpAddress of destination buffer pointer (advanced by call)
remainpAddress of integer holding amount of serialized object remaining
See also
encode_internal() for encoding format

Implements Hypertable::Serializable.

Definition at line 85 of file Status.cc.

void Status::encode_internal ( uint8_t **  bufp) const
overrideprivatevirtual

Writes serialized representation of object to a buffer.

Serialized format is as follows:

Parameters
bufpAddress of destination buffer pointer (advanced by call)
EncodingDescription
i32Status code
vstrStatus text

Implements Hypertable::Serializable.

Definition at line 80 of file Status.cc.

size_t Status::encoded_length_internal ( ) const
overrideprivatevirtual

Returns internal serialized length.

Returns
Internal serialized length
See also
encode_internal() for encoding format

Implements Hypertable::Serializable.

Definition at line 70 of file Status.cc.

uint8_t Status::encoding_version ( ) const
overrideprivatevirtual

Returns encoding version.

Returns
Encoding version

Implements Hypertable::Serializable.

Definition at line 66 of file Status.cc.

std::string Status::format_output_line ( const std::string &  service)

Formats a Nagios-style output line.

Formats and returns a Nagios-style output line in the following format:

SERVICE STATUS - status text
Parameters
serviceService name
Returns
Nagios-style output line.

Definition at line 92 of file Status.cc.

void Hypertable::Status::get ( Code code,
std::string &  text 
) const
inline

Gets status code and text.

Parameters
codeAddress of variable to hold status code
textReference to string variable to hold status text

Definition at line 111 of file Status.h.

Code Hypertable::Status::get ( )
inline

Gets status code.

Returns
Status code.

Definition at line 119 of file Status.h.

Status& Hypertable::Status::operator= ( const Status rhs)
inline

Copy assignment operator.

Parameters
rhsRight hand side object to copy

Definition at line 91 of file Status.h.

void Hypertable::Status::set ( Code  code,
const std::string &  text 
)
inline

Sets status code and text.

Parameters
codeStatus code
textStatus text

Definition at line 101 of file Status.h.

Status::Code Status::string_to_code ( std::string  str)
static

Definition at line 53 of file Status.cc.

Member Data Documentation

Code Hypertable::Status::m_code
private

Status code.

Definition at line 161 of file Status.h.

std::mutex Hypertable::Status::m_mutex
mutableprivate

Mutex for serializaing access to members

Definition at line 158 of file Status.h.

std::string Hypertable::Status::m_text
private

Status text.

Definition at line 164 of file Status.h.


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