Apparatus Version 1.10
ECS data-oriented workflow for Unreal Engine.
Classes | Macros | Enumerations | Functions
ApparatusStatus.h File Reference

The Apparatus status reporting facility. More...

#include "CoreUObject.h"
#include "Engine.h"
#include "UObject/Class.h"
#include "ApparatusRuntime.h"
#include "ApparatusStatus.generated.h"
Include dependency graph for ApparatusStatus.h:
This graph shows which files directly or indirectly include this file:

Classes

class  FApparatusDelegates
 The main core-level Apparatus delegates. More...
 

Macros

#define APPARATUS_STRINGIFY(symbol)   #symbol
 Stringify a symbol. More...
 
#define iAPPARATUS_REPORT_POSITIVE(Format, ...)
 
#define APPARATUS_REPORT(Status, Format, ...)
 Report a status with a formatted message. More...
 
#define APPARATUS_REPEAT_REPORT(Status, Format, ...)
 Repeat the report got from a previously called function. More...
 
#define APPARATUS_REPORT_SUCCESS(Format, ...)
 Report a success status with a formatted message. More...
 

Enumerations

enum class  EApparatusStatus : uint8 {
  None = 0 , Success = 128 , Noop = Success | 1 , DeferredSuccess = Success | 2 ,
  Error = 16 , InvalidArgument = Error + 1 , NullArgument = Error + 2 , OutOfRange = Error + 3 ,
  NotAvailable = Error + 4 , NotFound = Error + 5 , InvalidOperation = Error + 6 , InvalidState = Error + 7 ,
  Conflict = Error + 8 , NoPermission = Error + 9 , OutOfLimit = Error + 10 , NoMemory = Error + 11 ,
  FatalError = Error + 12 , CompletedWithIssue = Success | Error , CompletedWithInvalidArgument = Success | InvalidArgument , CompletedWithNullArgument = Success | NullArgument ,
  CompletedWithOutOfRange = Success | OutOfRange , CompletedWithNotAvailable = Success | NotAvailable , CompletedWithNotFound = Success | NotFound , CompletedWithInvalidOperation = Success | InvalidOperation ,
  CompletedWithInvalidState = Success | InvalidState , CompletedWithConflict = Success | Conflict , CompletedWithNoPermission = Success | NoPermission , CompletedWithOutOfLimit = Success | OutOfLimit ,
  CompletedWithNoMemory = Success | NoMemory
}
 The general Apparatus operation status type. More...
 

Functions

EApparatusStatus ExtractError (const EApparatusStatus Status)
 Extract an error from a status. More...
 
EApparatusStatus StatusCombine (const EApparatusStatus A, const EApparatusStatus B)
 Combine two statuses deriving a new one based on them. More...
 
template<size_t N>
EApparatusStatus StatusCombine (const EApparatusStatus(&Statuses)[N])
 Combine several statuses deriving a new one based on them. More...
 
template<typename ... Ts>
EApparatusStatus StatusCombine (const Ts... Statuses)
 Combine several statuses deriving a new one based on them. More...
 
EApparatusStatus StatusAccumulate (EApparatusStatus &A, const EApparatusStatus B)
 Accumulate a status with another status to the first operaad. More...
 
template<size_t N>
EApparatusStatus StatusAccumulate (EApparatusStatus &Status, const EApparatusStatus(&Statuses)[N])
 Accumulate several statuses deriving a new one based on them. More...
 
template<typename ... Ts>
EApparatusStatus StatusAccumulate (EApparatusStatus &Status, const Ts... Statuses)
 Accumulate several statuses deriving a new one based on them. More...
 
UEnum * GetApparatusStatusClass ()
 Get the Apparatus status class. More...
 
FString ToString (const EApparatusStatus Status)
 Convert an apparatus status variable to a string representation. More...
 
EApparatusStatus Report (const EApparatusStatus Status, const TCHAR *InMessage)
 Report a status along with a message. More...
 
EApparatusStatus Report (const EApparatusStatus Status, const TCHAR *InFormatString, const FStringFormatOrderedArguments &InOrderedArguments)
 Report a status with a formatted message. More...
 
EApparatusStatus Report (const EApparatusStatus Status, const TCHAR *InFormatString, const FStringFormatNamedArguments &InNamedArguments)
 Report a status with a formatted message. More...
 
template<EApparatusStatus Status>
EApparatusStatus Report (const TCHAR *InMessage)
 Report a status along with a message. More...
 
template<EApparatusStatus Status>
EApparatusStatus Report (const TCHAR *InFormatString, const FStringFormatOrderedArguments &InOrderedArguments)
 Report a status with a formatted message. More...
 
template<EApparatusStatus Status>
EApparatusStatus Report (const TCHAR *InFormatString, const FStringFormatNamedArguments &InNamedArguments)
 Report a status with a formatted message. More...
 

Detailed Description

The Apparatus status reporting facility.

Macro Definition Documentation

◆ APPARATUS_REPEAT_REPORT

#define APPARATUS_REPEAT_REPORT (   Status,
  Format,
  ... 
)
Value:
{ \
if (Status < EApparatusStatus::Success) \
{ \
{ \
UE_LOG(LogApparatus, \
Fatal, \
TEXT("↳: ") Format, \
##__VA_ARGS__); \
} \
else \
{ \
UE_LOG(LogApparatus, \
Error, \
TEXT("↳: ") Format, \
##__VA_ARGS__); \
} \
} \
else \
{ \
iAPPARATUS_REPORT_POSITIVE(TEXT("↳: ") Format, \
##__VA_ARGS__); \
} \
}
@ Success
Success status.
@ FatalError
Fatal error, leading to termination of execution.

Repeat the report got from a previously called function.

◆ APPARATUS_REPORT

#define APPARATUS_REPORT (   Status,
  Format,
  ... 
)
Value:
{ \
if (EApparatusStatus::Status < EApparatusStatus::Success) \
{ \
if (EApparatusStatus::Status >= EApparatusStatus::FatalError) \
{ \
UE_LOG(LogApparatus, \
Fatal, \
APPARATUS_STRINGIFY(Status) ": " Format, \
##__VA_ARGS__); \
} \
else \
{ \
EApparatusStatus::Status, \
FString::Printf(Format, ##__VA_ARGS__)); \
} \
} \
else \
{ \
iAPPARATUS_REPORT_POSITIVE(APPARATUS_STRINGIFY(Status) ": " Format, \
##__VA_ARGS__); \
} \
}
#define APPARATUS_STRINGIFY(symbol)
Stringify a symbol.
Definition: ApparatusStatus.h:370
static FReportStatusDelegate ReportError
Called to report an error status.
Definition: ApparatusStatus.h:415

Report a status with a formatted message.

Parameters
StatusThe status to report but without the EApparatusStatus:: prefix.
FormatThe format string to report with.
...The arguments to use within the format string.

◆ APPARATUS_REPORT_SUCCESS

#define APPARATUS_REPORT_SUCCESS (   Format,
  ... 
)
Value:
{ \
APPARATUS_REPORT(Success, Format, ##__VA_ARGS__); \
}

Report a success status with a formatted message.

◆ APPARATUS_STRINGIFY

#define APPARATUS_STRINGIFY (   symbol)    #symbol

Stringify a symbol.

◆ iAPPARATUS_REPORT_POSITIVE

#define iAPPARATUS_REPORT_POSITIVE (   Format,
  ... 
)

Enumeration Type Documentation

◆ EApparatusStatus

enum EApparatusStatus : uint8
strong

The general Apparatus operation status type.

Apparatus uses its own status reporting mechanism where applicable. Values greater than or equal to EApparatusStatus::Success are variations of success, lesser than - are errors.

Remarks
Report() functions should be used to report the status.
See also
Report()
Enumerator
None 

A special "not a status" identifier.

Success 

Success status.

The "no-error" identifier.

Noop 

Nothing actually needed to be done.

DeferredSuccess 

Deferred success status.

The operation has completed successfully but the actual changes are deferred to happen some later time.

Error 

General error identifier.

InvalidArgument 

One of the arguments was invalid.

NullArgument 

One of the required arguments was NULL.

OutOfRange 

The argument is out of range of allowed values.

NotAvailable 

Some kind of entity is not currently available.

NotFound 

Some kind of entity was not found.

InvalidOperation 

The operation is not valid in the current state.

InvalidState 

The current state is invalid (corrupted).

Conflict 

There is some kind of conflict or contradiction that has prevented the operation to succede.

NoPermission 

The operation is not permitted due to security reasons.

OutOfLimit 

The limit for some entities has been reached.

NoMemory 

Memory allocation has failed.

FatalError 

Fatal error, leading to termination of execution.

CompletedWithIssue 

The operation has completed, but there were some issues/errors.

CompletedWithInvalidArgument 

The operation has completed, but there is an invalid argument error.

CompletedWithNullArgument 

The operation has completed, but there is a null argument error.

CompletedWithOutOfRange 

The operation has completed, but there is an out-of-range error.

CompletedWithNotAvailable 

The operation has completed successfully, but the item is not/no longer available.

CompletedWithNotFound 

The operation has completed, but there is a not found error.

CompletedWithInvalidOperation 

The operation has completed, but there is an invalid operation error.

CompletedWithInvalidState 

The operation has completed, but there is an invalid state error.

CompletedWithConflict 

The operation has completed, but there is a conflict error.

CompletedWithNoPermission 

The operation has completed, but there is a no-permission error.

CompletedWithOutOfLimit 

The operation has completed, but there is an out-of-limit error.

CompletedWithNoMemory 

The operation has completed, but there is an out-of-memory error.

Function Documentation

◆ ExtractError()

EApparatusStatus ExtractError ( const EApparatusStatus  Status)
inline

Extract an error from a status.

◆ GetApparatusStatusClass()

UEnum* GetApparatusStatusClass ( )
inline

Get the Apparatus status class.

◆ Report() [1/6]

EApparatusStatus Report ( const EApparatusStatus  Status,
const TCHAR *  InFormatString,
const FStringFormatNamedArguments &  InNamedArguments 
)
inline

Report a status with a formatted message.

Parameters
StatusThe status to report.
InFormatStringThe format string to report with. Example: "{foo}/{bar}: {baz}"
InNamedArgumentsThe arguments to use within the format string.
Returns
The same status as passed.

◆ Report() [2/6]

EApparatusStatus Report ( const EApparatusStatus  Status,
const TCHAR *  InFormatString,
const FStringFormatOrderedArguments &  InOrderedArguments 
)
inline

Report a status with a formatted message.

Parameters
StatusThe status to report.
InFormatStringThe format string to report with. Example: "{0}/{1}: {2}"
InOrderedArgumentsThe arguments to use within the format string.
Returns
The same status as passed.

◆ Report() [3/6]

EApparatusStatus Report ( const EApparatusStatus  Status,
const TCHAR *  InMessage 
)
inline

Report a status along with a message.

Parameters
StatusThe status to report.
InMessageThe message to report along with the status.
Returns
The same status as passed.

◆ Report() [4/6]

template<EApparatusStatus Status>
EApparatusStatus Report ( const TCHAR *  InFormatString,
const FStringFormatNamedArguments &  InNamedArguments 
)
inline

Report a status with a formatted message.

Templated version.

Template Parameters
StatusThe status to report.
Parameters
InFormatStringThe format string to report with. Example: "{foo}/{bar}: {baz}"
InNamedArgumentsThe arguments to use within the format string.
Returns
The same status as passed.

◆ Report() [5/6]

template<EApparatusStatus Status>
EApparatusStatus Report ( const TCHAR *  InFormatString,
const FStringFormatOrderedArguments &  InOrderedArguments 
)
inline

Report a status with a formatted message.

Templated version.

Template Parameters
StatusThe status to report.
Parameters
InFormatStringThe format string to report with. Example: "{0}/{1}: {2}"
InOrderedArgumentsThe arguments to use within the format string.
Returns
The same status as passed.

◆ Report() [6/6]

template<EApparatusStatus Status>
EApparatusStatus Report ( const TCHAR *  InMessage)
inline

Report a status along with a message.

Templated version.

Template Parameters
StatusThe status to report.
Parameters
InMessageThe message to report along with the status.
Returns
The same status as passed.

◆ StatusAccumulate() [1/3]

EApparatusStatus StatusAccumulate ( EApparatusStatus A,
const EApparatusStatus  B 
)
inline

Accumulate a status with another status to the first operaad.

◆ StatusAccumulate() [2/3]

template<size_t N>
EApparatusStatus StatusAccumulate ( EApparatusStatus Status,
const EApparatusStatus(&)  Statuses[N] 
)
inline

Accumulate several statuses deriving a new one based on them.

◆ StatusAccumulate() [3/3]

template<typename ... Ts>
EApparatusStatus StatusAccumulate ( EApparatusStatus Status,
const Ts...  Statuses 
)
inline

Accumulate several statuses deriving a new one based on them.

Be warned the the order of evaluation for function arguments is not explicitly defined or guaranteed in C++.

◆ StatusCombine() [1/3]

EApparatusStatus StatusCombine ( const EApparatusStatus  A,
const EApparatusStatus  B 
)
inline

Combine two statuses deriving a new one based on them.

Be warned the the order of evaluation for function arguments is not explicitly defined or guaranteed in C++.

◆ StatusCombine() [2/3]

template<size_t N>
EApparatusStatus StatusCombine ( const EApparatusStatus(&)  Statuses[N])
inline

Combine several statuses deriving a new one based on them.

◆ StatusCombine() [3/3]

template<typename ... Ts>
EApparatusStatus StatusCombine ( const Ts...  Statuses)
inline

Combine several statuses deriving a new one based on them.

Be warned the the order of evaluation for function arguments is not explicitly defined or guaranteed in C++.

◆ ToString()

FString ToString ( const EApparatusStatus  Status)
inline

Convert an apparatus status variable to a string representation.