PVData C++  8.0.3
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
epics::pvData::Status Class Reference

Status. More...

#include <misc/pv/status.h>

Inheritance diagram for epics::pvData::Status:
Inheritance graph
[legend]
Collaboration diagram for epics::pvData::Status:
Collaboration graph
[legend]

Public Types

enum  StatusType { STATUSTYPE_OK, STATUSTYPE_WARNING, STATUSTYPE_ERROR, STATUSTYPE_FATAL }
 
typedef std::tr1::shared_ptr< Statusshared_pointer
 
typedef std::tr1::shared_ptr< const Statusconst_shared_pointer
 
typedef std::tr1::weak_ptr< Statusweak_pointer
 
typedef std::tr1::weak_ptr< const Statusconst_weak_pointer
 

Public Member Functions

 Status ()
 
 Status (StatusType type, std::string const &message)
 
 Status (StatusType type, std::string const &message, std::string const &stackDump)
 
StatusType getType () const
 
const std::stringgetMessage () const
 
const std::stringgetStackDump () const
 
bool isOK () const
 
bool isSuccess () const
 
 operator truth_type () const
 
void maximize (const Status &o)
 
Statusoperator|= (const Status &o)
 short hand for "this->maximize(o)"
 
void serialize (ByteBuffer *buffer, SerializableControl *flusher) const
 
void deserialize (ByteBuffer *buffer, DeserializableControl *flusher)
 
void dump (std::ostream &o) const
 
- Public Member Functions inherited from epics::pvData::Serializable
virtual ~Serializable ()
 

Static Public Member Functions

static Status warn (const std::string &m)
 
static Status error (const std::string &m)
 
static Status fatal (const std::string &m)
 

Static Public Attributes

static const char * StatusTypeName []
 
static Status Ok
 

Detailed Description

Status.

This is a class for returning status to clients.

Author
mse

Definition at line 28 of file status.h.

Member Enumeration Documentation

◆ StatusType

Status type enum.

Enumerator
STATUSTYPE_OK 

Operation completed successfully.

STATUSTYPE_WARNING 

Operation completed successfully, but there is a warning message.

STATUSTYPE_ERROR 

Operation failed due to an error.

STATUSTYPE_FATAL 

Operation failed due to an unexpected error.

Definition at line 34 of file status.h.

Constructor & Destructor Documentation

◆ Status() [1/3]

epics::pvData::Status::Status ( )
inline

Creates OK status; STATUSTYPE_OK, empty message and stackDump.

Definition at line 56 of file status.h.

◆ Status() [2/3]

epics::pvData::Status::Status ( StatusType  type,
std::string const &  message 
)

Create non-OK status.

◆ Status() [3/3]

epics::pvData::Status::Status ( StatusType  type,
std::string const &  message,
std::string const &  stackDump 
)

Create non-OK status.

Member Function Documentation

◆ deserialize()

void epics::pvData::Status::deserialize ( ByteBuffer buffer,
DeserializableControl flusher 
)
virtual

Deserialize buffer.

Parameters
bufferserialization buffer.
flusherdeserialization control.

Implements epics::pvData::Serializable.

◆ getMessage()

const std::string& epics::pvData::Status::getMessage ( ) const
inline

Get error message describing an error. Required if error status.

Returns
error message.

Definition at line 80 of file status.h.

◆ getStackDump()

const std::string& epics::pvData::Status::getStackDump ( ) const
inline

Get stack dump where error (exception) happened. Optional.

Returns
stack dump.

Definition at line 86 of file status.h.

◆ getType()

StatusType epics::pvData::Status::getType ( ) const
inline

Get status type.

Returns
status type, non-null.

Definition at line 74 of file status.h.

◆ isOK()

bool epics::pvData::Status::isOK ( ) const
inline

Convenient OK test. Same as (getType() == StatusType.OK). NOTE: this will return false on WARNING message although operation succeeded. To check if operation succeeded, use isSuccess.

Returns
OK status.
See also
isSuccess()

Definition at line 95 of file status.h.

◆ isSuccess()

bool epics::pvData::Status::isSuccess ( ) const
inline

Check if operation succeeded (OK or WARNING).

Returns
operation success status.

Definition at line 103 of file status.h.

◆ maximize()

void epics::pvData::Status::maximize ( const Status o)

override this Status if the other has higher StatusType

Status ret;
ret |= call1();
if(ret)
ret |= call2();
return ret;

◆ serialize()

void epics::pvData::Status::serialize ( ByteBuffer buffer,
SerializableControl flusher 
) const
virtual

Serialize field into given buffer.

Parameters
bufferserialization buffer.
flusherflush interface.

Implements epics::pvData::Serializable.


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