PMDA++  0.4.4
Header-only C++ library for writing PCP PMDAs
Public Member Functions | Protected Attributes | List of all members
pcp::exception Class Reference

Base class for all PMDA++ exceptions. More...

#include <exception.hpp>

Inheritance diagram for pcp::exception:
Inheritance graph
[legend]
Collaboration diagram for pcp::exception:
Collaboration graph
[legend]

Public Member Functions

 exception (const int pm_error_code, const std::string &message=std::string())
 Constructor. More...
 
 exception (const pcp::exception &other)
 Copy constructor. More...
 
virtual ~exception () throw ()
 Virtual destructor. More...
 
virtual int error_code () const
 Get this exception's error code. More...
 
virtual const char * what () const throw ()
 Get this exception's error message. More...
 

Protected Attributes

int pm_error_code
 PCP error code. More...
 
std::string message
 Error message. More...
 

Detailed Description

Base class for all PMDA++ exceptions.

Definition at line 25 of file exception.hpp.

Constructor & Destructor Documentation

◆ exception() [1/2]

pcp::exception::exception ( const int  pm_error_code,
const std::string &  message = std::string() 
)
inline

Constructor.

If the optional message is not provided (or is empty), then either pmErrStr_r (if available) or pmErrStr will be used to fetch PCP's message for pm_error_code.

Parameters
pm_error_codePCP error code.
messageError message.
See also
pmErrStr
pmErrStr_r

Definition at line 42 of file exception.hpp.

References message.

◆ exception() [2/2]

pcp::exception::exception ( const pcp::exception other)
inline

Copy constructor.

Parameters
otherOther pcp::exception object to copy.

Definition at line 63 of file exception.hpp.

◆ ~exception()

virtual pcp::exception::~exception ( )
throw (
)
inlinevirtual

Virtual destructor.

For safe polymorphic destruction.

Definition at line 75 of file exception.hpp.

Member Function Documentation

◆ error_code()

virtual int pcp::exception::error_code ( ) const
inlinevirtual

Get this exception's error code.

Returns
This exception's error code.

Definition at line 82 of file exception.hpp.

References pm_error_code.

Referenced by pcp::pmda::on_fetch(), pcp::pmda::on_fetch_callback(), pcp::pmda::on_store(), and pcp::pmda::on_text().

◆ what()

virtual const char* pcp::exception::what ( ) const
throw (
)
inlinevirtual

Get this exception's error message.

Returns
This exception's error message.

Definition at line 92 of file exception.hpp.

References message.

Referenced by pcp::pmda::on_fetch(), pcp::pmda::on_fetch_callback(), pcp::pmda::on_store(), and pcp::pmda::on_text().

Member Data Documentation

◆ message

std::string pcp::exception::message
protected

Error message.

Definition at line 99 of file exception.hpp.

Referenced by exception(), and what().

◆ pm_error_code

int pcp::exception::pm_error_code
protected

PCP error code.

Definition at line 98 of file exception.hpp.

Referenced by error_code().


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