UMPS
The University of Utah Seismograph Stations Message Passing System.
UMPS::MessageFormats::Failure Class Reference

This message is a general failure message. For generalized request-reply mechanisms, the server side code cannot terminate with an exception. In these truly exceptional situations, this generic failure message can be returned. More...

#include "umps/messageFormats/failure.hpp"

Inheritance diagram for UMPS::MessageFormats::Failure:
Collaboration diagram for UMPS::MessageFormats::Failure:

Public Member Functions

void setDetails (const std::string &details) noexcept
 Sets the details of a failure message. More...
 
std::string getDetails () const noexcept
 
Constructors
 Failure ()
 Constructor.
 
 Failure (const Failure &message)
 Copy constructor. More...
 
 Failure (Failure &&message) noexcept
 Move constructor. More...
 
Operators
Failureoperator= (const Failure &message)
 Copy assignment. More...
 
Failureoperator= (Failure &&message) noexcept
 Move assignment. More...
 
Message Abstract Base Class Properties
std::string toMessage () const final
 Converts the failure class to a string message. More...
 
void fromMessage (const std::string &message) final
 Creates the class from a message. More...
 
void fromMessage (const char *data, size_t length) final
 Creates the class from a message. More...
 
std::string getMessageType () const noexcept final
 
std::string getMessageVersion () const noexcept final
 
std::unique_ptr< UMPS::MessageFormats::IMessageclone () const final
 
std::unique_ptr< UMPS::MessageFormats::IMessagecreateInstance () const noexcept final
 
Destructors
void clear () noexcept
 Resets the class and releases all memory.
 
 ~Failure () override
 Destructor.
 
- Public Member Functions inherited from UMPS::MessageFormats::IMessage
virtual ~IMessage ()
 Destructor.
 

Detailed Description

This message is a general failure message. For generalized request-reply mechanisms, the server side code cannot terminate with an exception. In these truly exceptional situations, this generic failure message can be returned.

Constructor & Destructor Documentation

◆ Failure() [1/2]

UMPS::MessageFormats::Failure::Failure ( const Failure message)

Copy constructor.

Parameters
[in]messageThe failure message class from which to initialize this class.

◆ Failure() [2/2]

UMPS::MessageFormats::Failure::Failure ( Failure &&  message)
noexcept

Move constructor.

Parameters
[in,out]messageThe failure message class from which to initialize this class. On exit, message's behavior is undefined.

Member Function Documentation

◆ clone()

std::unique_ptr<UMPS::MessageFormats::IMessage> UMPS::MessageFormats::Failure::clone ( ) const
finalvirtual
Returns
A copy of this class.

Implements UMPS::MessageFormats::IMessage.

◆ createInstance()

std::unique_ptr<UMPS::MessageFormats::IMessage> UMPS::MessageFormats::Failure::createInstance ( ) const
finalvirtualnoexcept
Returns
An uninitialized instance of this class.

Implements UMPS::MessageFormats::IMessage.

◆ fromMessage() [1/2]

void UMPS::MessageFormats::Failure::fromMessage ( const char *  data,
size_t  length 
)
finalvirtual

Creates the class from a message.

Parameters
[in]dataThe contents of the message. This is an array whose dimension is [length]
[in]lengthThe length of data.
Exceptions
std::runtime_errorif the message is invalid.
std::invalid_argumentif data is NULL or length is 0.

Implements UMPS::MessageFormats::IMessage.

◆ fromMessage() [2/2]

void UMPS::MessageFormats::Failure::fromMessage ( const std::string &  message)
finalvirtual

Creates the class from a message.

Parameters
[in]messageThe contents of the message.
Exceptions
std::runtime_errorif the message is invalid.
std::invalid_argumentif data.empty() is true.

Implements UMPS::MessageFormats::IMessage.

◆ getDetails()

std::string UMPS::MessageFormats::Failure::getDetails ( ) const
noexcept
Returns
The failure details.

◆ getMessageType()

std::string UMPS::MessageFormats::Failure::getMessageType ( ) const
finalvirtualnoexcept
Returns
A message type indicating this is a failure message.

Implements UMPS::MessageFormats::IMessage.

◆ getMessageVersion()

std::string UMPS::MessageFormats::Failure::getMessageVersion ( ) const
finalvirtualnoexcept
Returns
The message version.

Implements UMPS::MessageFormats::IMessage.

◆ operator=() [1/2]

Failure& UMPS::MessageFormats::Failure::operator= ( const Failure message)

Copy assignment.

Parameters
[in]messageThe failure message class to copy to this.
Returns
A deep copy of the failure message.

◆ operator=() [2/2]

Failure& UMPS::MessageFormats::Failure::operator= ( Failure &&  message)
noexcept

Move assignment.

Parameters
[in,out]messageThe failure message class whose memory will be moved to this. On exit, messages's behavior is undefined.
Returns
The memory from message moved to this.

◆ setDetails()

void UMPS::MessageFormats::Failure::setDetails ( const std::string &  details)
noexcept

Sets the details of a failure message.

Parameters
[in]detailsThe failure details to set.

◆ toMessage()

std::string UMPS::MessageFormats::Failure::toMessage ( ) const
finalvirtual

Converts the failure class to a string message.

Returns
The class expressed as a string message.
Exceptions
std::runtime_errorif the required information is not set.
Note
Though the container is a string the message need not be human readable.

Implements UMPS::MessageFormats::IMessage.


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