Apparatus Version 1.23
ECS data-oriented workflow for Unreal Engine.
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
TPoliteOutcome< PayloadT > Struct Template Reference

Polite outcome with a status and an optional payload. More...

#include <ApparatusStatus.h>

Inheritance diagram for TPoliteOutcome< PayloadT >:
Inheritance graph
[legend]
Collaboration diagram for TPoliteOutcome< PayloadT >:
Collaboration graph
[legend]

Public Types

using PayloadType = PayloadT
 The type of the payload in the outcome.
 

Public Member Functions

constexpr EApparatusStatus ToStatus () const
 Convert to a status constant.
 
constexpr bool IsNoop () const
 Check if the outcome is a noop.
 
TPoliteOutcomeMapStatus (const EApparatusStatus From, const EApparatusStatus To)
 Map the status from a status to a status.
 
PayloadT GetPayload () const
 Get the payload.
 
auto operator-> () const
 A non-empty outcomes serves as a pointer to its payload by default.
 
constexpr const PayloadT & operator* () const
 Get a constant reference to a payload.
 
constexpr PayloadT & operator* ()
 Get a reference to a payload.
 
template<typename T >
TPoliteOutcome< TStaticCast ()
 Cast the payload statically.
 
TPoliteOutcome< PayloadT & > Dereference ()
 Dereference.
 
constexpr operator EApparatusStatus () const
 Convert to a status.
 
 operator PayloadT () const
 Convert to a payload.
 
constexpr bool IsOK () const
 Convert to success state for using in a conditional expression.
 
constexpr bool operator== (const PayloadT &Other) const
 
constexpr bool operator!= (const PayloadT &Other) const
 
template<typename InPayloadT >
TPoliteOutcomeoperator+= (const THarshOutcome< InPayloadT > &)
 Accumulate a harsh outcome with an optional payload.
 
TPoliteOutcomeoperator+= (const EApparatusStatus InStatus)
 Accumulate a status within the outcome.
 
constexpr TPoliteOutcome operator+ (const EApparatusStatus InStatus) const
 
FString ToString () const
 
Initialization
constexpr TPoliteOutcome ()
 Initialize a default polite outcome using a noop status and a default payload.
 
template<typename InPayloadT >
constexpr TPoliteOutcome (InPayloadT &&InPayload)
 Initialize a polite outcome with a payload only.
 
constexpr TPoliteOutcome (const EApparatusStatus InStatus)
 Initialize a polite outcome using a status and a default payload.
 
template<typename InPayloadT >
constexpr TPoliteOutcome (const EApparatusStatus InStatus, InPayloadT &&InPayload)
 Initialize a polite outcome using a status and a payload.
 
template<typename InPayloadT >
constexpr TPoliteOutcome (THarshOutcome< InPayloadT > &&InOutcome)
 Initialize a polite outcome using a harsh outcome.
 
template<typename InPayloadT >
constexpr TPoliteOutcome (const THarshOutcome< InPayloadT > &InOutcome)
 Initialize a polite outcome using a harsh outcome.
 
template<typename InPayloadT >
constexpr TPoliteOutcome (TPoliteOutcome< InPayloadT > &&InOutcome)
 Initialize a copy of the polite outcome.
 
template<typename InPayloadT >
constexpr TPoliteOutcome (const TPoliteOutcome< InPayloadT > &InOutcome)
 Initialize a copy of the polite outcome.
 
template<typename AnyPayloadT , typename InPayloadT >
constexpr TPoliteOutcome (const THarshOutcome< AnyPayloadT > &InOutcome, InPayloadT &&InPayload)
 Initialize a polite outcome using a harsh outcome and a payload override.
 
template<typename AnyPayloadT , typename InPayloadT >
constexpr TPoliteOutcome (const TPoliteOutcome< AnyPayloadT > &InOutcome, InPayloadT &&InPayload)
 Initialize a polite outcome using a polite outcome and a payload override.
 

Static Public Member Functions

static constexpr TPoliteOutcome< PayloadT > Success (const PayloadT &InPayload)
 A constant denoting a successful operation outcome.
 
static constexpr TPoliteOutcome< PayloadT > Noop (const PayloadT &InPayload)
 A constant denoting a successful skip of any actions.
 

Public Attributes

EApparatusStatus Status
 The embedded status of the outcome.
 
PayloadT Payload
 The payload of the outcome.
 

Detailed Description

template<typename PayloadT>
struct TPoliteOutcome< PayloadT >

Polite outcome with a status and an optional payload.

Template Parameters
PayloadTThe optional payload type.

Member Typedef Documentation

◆ PayloadType

template<typename PayloadT >
using TPoliteOutcome< PayloadT >::PayloadType = PayloadT

The type of the payload in the outcome.

Constructor & Destructor Documentation

◆ TPoliteOutcome() [1/10]

template<typename PayloadT >
constexpr TPoliteOutcome< PayloadT >::TPoliteOutcome ( )
inlineconstexpr

Initialize a default polite outcome using a noop status and a default payload.

◆ TPoliteOutcome() [2/10]

template<typename PayloadT >
template<typename InPayloadT >
constexpr TPoliteOutcome< PayloadT >::TPoliteOutcome ( InPayloadT &&  InPayload)
inlineconstexpr

Initialize a polite outcome with a payload only.

Initializing an outcome using only its payload is considered to be a valid, successful outcome.

Template Parameters
InPayloadTThe type of the payload to initialize with.
Parameters
InPayloadThe payload to initialize with.

◆ TPoliteOutcome() [3/10]

template<typename PayloadT >
constexpr TPoliteOutcome< PayloadT >::TPoliteOutcome ( const EApparatusStatus  InStatus)
inlineconstexpr

Initialize a polite outcome using a status and a default payload.

Template Parameters
InPayloadTThe type of the payload to override with.
Parameters
InStatusThe status to initialize with.

◆ TPoliteOutcome() [4/10]

template<typename PayloadT >
template<typename InPayloadT >
constexpr TPoliteOutcome< PayloadT >::TPoliteOutcome ( const EApparatusStatus  InStatus,
InPayloadT &&  InPayload 
)
inlineconstexpr

Initialize a polite outcome using a status and a payload.

Template Parameters
InPayloadTThe type of the payload to override with.
Parameters
InStatusThe status to initialize from.
InPayloadThe payload to initialize with.

◆ TPoliteOutcome() [5/10]

template<typename PayloadT >
template<typename InPayloadT >
constexpr TPoliteOutcome< PayloadT >::TPoliteOutcome ( THarshOutcome< InPayloadT > &&  InOutcome)
inlineconstexpr

Initialize a polite outcome using a harsh outcome.

Moving version.

Template Parameters
InPayloadTThe type of the payload to override with.
Parameters
InOutcomeThe outcome to initialize from, while moving its payload.

◆ TPoliteOutcome() [6/10]

template<typename PayloadT >
template<typename InPayloadT >
constexpr TPoliteOutcome< PayloadT >::TPoliteOutcome ( const THarshOutcome< InPayloadT > &  InOutcome)
inlineconstexpr

Initialize a polite outcome using a harsh outcome.

Template Parameters
InPayloadTThe type of the payload to override with.
Parameters
InOutcomeThe outcome to initialize from.

◆ TPoliteOutcome() [7/10]

template<typename PayloadT >
template<typename InPayloadT >
constexpr TPoliteOutcome< PayloadT >::TPoliteOutcome ( TPoliteOutcome< InPayloadT > &&  InOutcome)
inlineconstexpr

Initialize a copy of the polite outcome.

Moving version.

Template Parameters
InPayloadTThe type of the payload to move.
Parameters
InOutcomeThe outcome to move.

◆ TPoliteOutcome() [8/10]

template<typename PayloadT >
template<typename InPayloadT >
constexpr TPoliteOutcome< PayloadT >::TPoliteOutcome ( const TPoliteOutcome< InPayloadT > &  InOutcome)
inlineconstexpr

Initialize a copy of the polite outcome.

Template Parameters
InPayloadTThe type of the payload to copy.
Parameters
InOutcomeThe outcome to copy.

◆ TPoliteOutcome() [9/10]

template<typename PayloadT >
template<typename AnyPayloadT , typename InPayloadT >
constexpr TPoliteOutcome< PayloadT >::TPoliteOutcome ( const THarshOutcome< AnyPayloadT > &  InOutcome,
InPayloadT &&  InPayload 
)
inlineconstexpr

Initialize a polite outcome using a harsh outcome and a payload override.

Template Parameters
AnyPayloadTThe type of the payload
InPayloadTThe type of the payload to override with.
Parameters
InOutcomeThe outcome to initialize from. This is basically ignored here.
InPayloadThe payload to initialize with.

◆ TPoliteOutcome() [10/10]

template<typename PayloadT >
template<typename AnyPayloadT , typename InPayloadT >
constexpr TPoliteOutcome< PayloadT >::TPoliteOutcome ( const TPoliteOutcome< AnyPayloadT > &  InOutcome,
InPayloadT &&  InPayload 
)
inlineconstexpr

Initialize a polite outcome using a polite outcome and a payload override.

Template Parameters
AnyPayloadTThe type of the payload
InPayloadTThe type of the payload to override with.
Parameters
InOutcomeThe outcome to initialize from. This is basically ignored here.
InPayloadThe payload to initialize with.

Member Function Documentation

◆ Dereference()

template<typename PayloadT >
TPoliteOutcome< PayloadT & > TPoliteOutcome< PayloadT >::Dereference ( )
inline

Dereference.

◆ GetPayload()

template<typename PayloadT >
PayloadT TPoliteOutcome< PayloadT >::GetPayload ( ) const
inline

Get the payload.

◆ IsNoop()

template<typename PayloadT >
constexpr bool TPoliteOutcome< PayloadT >::IsNoop ( ) const
inlineconstexpr

Check if the outcome is a noop.

◆ IsOK()

template<typename PayloadT >
constexpr bool TPoliteOutcome< PayloadT >::IsOK ( ) const
inlineconstexpr

Convert to success state for using in a conditional expression.

Returns true for successful statuses, false otherwise.

Returns
The state of examination.

◆ MapStatus()

template<typename PayloadT >
TPoliteOutcome & TPoliteOutcome< PayloadT >::MapStatus ( const EApparatusStatus  From,
const EApparatusStatus  To 
)
inline

Map the status from a status to a status.

Parameters
FromThe status to map from.
ToThe status to map to.
Returns
Returns itself.

◆ Noop()

template<typename PayloadT >
static constexpr TPoliteOutcome< PayloadT > TPoliteOutcome< PayloadT >::Noop ( const PayloadT &  InPayload)
inlinestaticconstexpr

A constant denoting a successful skip of any actions.

◆ operator EApparatusStatus()

template<typename PayloadT >
constexpr TPoliteOutcome< PayloadT >::operator EApparatusStatus ( ) const
inlineconstexpr

Convert to a status.

This is an explicit conversion for a polite outcome.

Returns
The embedded captured status.

◆ operator PayloadT()

template<typename PayloadT >
TPoliteOutcome< PayloadT >::operator PayloadT ( ) const
inline

Convert to a payload.

◆ operator!=()

template<typename PayloadT >
constexpr bool TPoliteOutcome< PayloadT >::operator!= ( const PayloadT &  Other) const
inlineconstexpr

◆ operator*() [1/2]

template<typename PayloadT >
constexpr PayloadT & TPoliteOutcome< PayloadT >::operator* ( )
inlineconstexpr

Get a reference to a payload.

◆ operator*() [2/2]

template<typename PayloadT >
constexpr const PayloadT & TPoliteOutcome< PayloadT >::operator* ( ) const
inlineconstexpr

Get a constant reference to a payload.

◆ operator+()

template<typename PayloadT >
constexpr TPoliteOutcome TPoliteOutcome< PayloadT >::operator+ ( const EApparatusStatus  InStatus) const
inlineconstexpr

◆ operator+=() [1/2]

template<typename PayloadT >
TPoliteOutcome & TPoliteOutcome< PayloadT >::operator+= ( const EApparatusStatus  InStatus)
inline

Accumulate a status within the outcome.

Parameters
InStatusThe status to accumulate.
Returns
Returns itself.

◆ operator+=() [2/2]

template<typename PayloadT >
template<typename InPayloadT >
TPoliteOutcome & TPoliteOutcome< PayloadT >::operator+= ( const THarshOutcome< InPayloadT > &  )
inline

Accumulate a harsh outcome with an optional payload.

This is semantically equivalent to accumulating a success status since any harsh outcome is already a success.

Template Parameters
InPayloadTThe payload of the harsh outcome.
Returns
Returns itself as a result.

◆ operator->()

template<typename PayloadT >
auto TPoliteOutcome< PayloadT >::operator-> ( ) const
inline

A non-empty outcomes serves as a pointer to its payload by default.

◆ operator==()

template<typename PayloadT >
constexpr bool TPoliteOutcome< PayloadT >::operator== ( const PayloadT &  Other) const
inlineconstexpr

◆ StaticCast()

template<typename PayloadT >
template<typename T >
TPoliteOutcome< T > TPoliteOutcome< PayloadT >::StaticCast ( )
inline

Cast the payload statically.

Template Parameters
Thetype to cast to.

◆ Success()

template<typename PayloadT >
static constexpr TPoliteOutcome< PayloadT > TPoliteOutcome< PayloadT >::Success ( const PayloadT &  InPayload)
inlinestaticconstexpr

A constant denoting a successful operation outcome.

◆ ToStatus()

template<typename PayloadT >
constexpr EApparatusStatus TPoliteOutcome< PayloadT >::ToStatus ( ) const
inlineconstexpr

Convert to a status constant.

Returns
The embedded captured status.

◆ ToString()

template<typename PayloadT >
FString TPoliteOutcome< PayloadT >::ToString ( ) const
inline

Member Data Documentation

◆ Payload

template<typename PayloadT >
PayloadT TPoliteOutcome< PayloadT >::Payload

The payload of the outcome.

◆ Status

template<typename PayloadT >
EApparatusStatus TPoliteOutcome< PayloadT >::Status

The embedded status of the outcome.


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