CppWAMP
C++11 client library for the WAMP protocol
wamp::Outcome Class Reference

Contains the outcome of an RPC invocation. More...

#include <cppwamp/peerdata.hpp>

Public Types

enum  Type {
  Type::deferred,
  Type::result,
  Type::error
}
 Enumerators representing the type of outcome being held by this object. More...
 

Public Member Functions

 Outcome ()
 Default-constructs an outcome containing an empty Result object. More...
 
 Outcome (Result result)
 Converting constructor taking a Result object. More...
 
 Outcome (std::initializer_list< Variant > args)
 Converting constructor taking a braced initializer list of positional arguments to be stored in a Result. More...
 
 Outcome (Error error)
 Converting constructor taking an Error object. More...
 
 Outcome (Deferment)
 Converting constructor taking a deferment. More...
 
 Outcome (const Outcome &other)
 Copy constructor. More...
 
 Outcome (Outcome &&other)
 Move constructor. More...
 
 ~Outcome ()
 Destructor.
 
Type type () const
 Obtains the object type being contained.
 
const ResultasResult () const &
 Accesses the stored Result object. More...
 
Result && asResult () &&
 Steals the stored Result object.
 
const ErrorasError () const &
 Accesses the stored Error object. More...
 
Error && asError () &&
 Steals the stored Error object.
 
Outcomeoperator= (const Outcome &other)
 Copy-assignment operator. More...
 
Outcomeoperator= (Outcome &&other)
 Move-assignment operator. More...
 

Static Public Member Functions

static Outcome deferred ()
 Constructs an Outcome having Type::deferred. More...
 

Detailed Description

Contains the outcome of an RPC invocation.

See also
RPC Outcomes

Member Enumeration Documentation

◆ Type

enum wamp::Outcome::Type
strong

Enumerators representing the type of outcome being held by this object.

Enumerator
deferred 

A YIELD has been, or will be, sent manually.

result 

Contains a wamp::Result to be yielded back to the caller.

error 

Contains a wamp::Error to be yielded back to the caller.

Constructor & Destructor Documentation

◆ Outcome() [1/7]

wamp::Outcome::Outcome ( )

Default-constructs an outcome containing an empty Result object.

Postcondition
this->type() == Type::result

◆ Outcome() [2/7]

wamp::Outcome::Outcome ( Result  result)

Converting constructor taking a Result object.

Postcondition
this->type() == Type::result

◆ Outcome() [3/7]

wamp::Outcome::Outcome ( std::initializer_list< Variant args)

Converting constructor taking a braced initializer list of positional arguments to be stored in a Result.

Postcondition
this->type() == Type::result

◆ Outcome() [4/7]

wamp::Outcome::Outcome ( Error  error)

Converting constructor taking an Error object.

Postcondition
this->type() == Type::error

◆ Outcome() [5/7]

wamp::Outcome::Outcome ( Deferment  )

Converting constructor taking a deferment.

Postcondition
this->type() == Type::deferred

◆ Outcome() [6/7]

wamp::Outcome::Outcome ( const Outcome other)

Copy constructor.

Postcondition
this->type() == other.type()

◆ Outcome() [7/7]

wamp::Outcome::Outcome ( wamp::Outcome &&  other)

Move constructor.

Postcondition
this->type() == other.type()
other.type() == Type::deferred

Member Function Documentation

◆ deferred()

Outcome wamp::Outcome::deferred ( )
static

Constructs an Outcome having Type::deferred.

Deprecated:
Use wamp::deferment instead.

◆ asResult()

Result && wamp::Outcome::asResult ( ) const &

Accesses the stored Result object.

Precondition
this->type() == Type::result

◆ asError()

Error && wamp::Outcome::asError ( ) const &

Accesses the stored Error object.

Precondition
this->type() == Type::error

◆ operator=() [1/2]

Outcome & wamp::Outcome::operator= ( const Outcome other)

Copy-assignment operator.

Postcondition
this->type() == other.type()

◆ operator=() [2/2]

Outcome & wamp::Outcome::operator= ( Outcome &&  other)

Move-assignment operator.

Postcondition
this->type() == other.type()
other.type() == Type::deferred

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