AAX SDK 2.8.0
Avid Audio Extensions Development Kit
Loading...
Searching...
No Matches
List of all members | Public Member Functions
AAX_AggregateResult Class Reference

#include <AAX_Exception.h>

Description

RAII failure count convenience class for use with AAX_CAPTURE() or AAX_CAPTURE_MULT()

Pass this object as the first argument in a series of AAX_CAPTURE() calls to count the number of failures that occur and to re-throw the last error if zero of the attempted calls succeed.

// example A: throw if all operations fail
AAX_CAPTURE( agg, RegisterThingA(); );
AAX_CAPTURE( agg, RegisterThingB(); );
AAX_CAPTURE( agg, RegisterThingC(); );
#define AAX_CAPTURE(X,...)
Executes Y in a try/catch block that catches AAX::Exception::ResultError exceptions and captures the ...
Definition: AAX_Exception.h:528
Definition: AAX_Exception.h:618

In this example, when agg goes out of scope it checks whether any of A, B, or C succeeded. If none succeeded then the last error that was encountered is raised via an AAX_CheckedResult::Exception. If at least one of the calls succeeded then any failures are swallowed and execution continues as normal. This approach can be useful in cases where you want to run every operation in a group and you only want a failure to be returned if all of the operations failed.

// example B: throw if any operation fails
AAX_CAPTURE( agg, ImportantOperationW(); );
AAX_CAPTURE( agg, ImportantOperationX(); );
AAX_CAPTURE( agg, ImportantOperationY(); );
Definition: AAX_Exception.h:343

In this example, the last error encountered by agg is converted to an AAX_CheckedResult. This will result in an AAX_CheckedResult::Exception even if at least one of the attempted operations succeeded. This approach can be useful in cases where you want all operations in a group to be executed before an error is raised for any failure within the group.

Public Member Functions

 AAX_AggregateResult ()=default
 
 ~AAX_AggregateResult ()
 
AAX_AggregateResultoperator= (AAX_Result inResult)
 Overloaded operator=() for conversion from AAX_Result.
 
 operator AAX_Result ()
 Implicit conversion to AAX_Result clears the state.
 
void Check () const
 
void Clear ()
 
AAX_Result LastFailure () const
 
int NumFailed () const
 
int NumSucceeded () const
 
int NumAttempted () const
 

Constructor & Destructor Documentation

◆ AAX_AggregateResult()

AAX_AggregateResult::AAX_AggregateResult ( )
default

◆ ~AAX_AggregateResult()

AAX_AggregateResult::~AAX_AggregateResult ( )
inline

References Check().

Here is the call graph for this function:

Member Function Documentation

◆ operator=()

AAX_AggregateResult & AAX_AggregateResult::operator= ( AAX_Result  inResult)
inline

Overloaded operator=() for conversion from AAX_Result.

References AAX_SUCCESS.

◆ operator AAX_Result()

AAX_AggregateResult::operator AAX_Result ( )
inline

Implicit conversion to AAX_Result clears the state.

References Clear(), and LastFailure().

Here is the call graph for this function:

◆ Check()

void AAX_AggregateResult::Check ( ) const
inline

Referenced by ~AAX_AggregateResult().

Here is the caller graph for this function:

◆ Clear()

void AAX_AggregateResult::Clear ( )
inline

References AAX_SUCCESS.

Referenced by operator AAX_Result().

Here is the caller graph for this function:

◆ LastFailure()

AAX_Result AAX_AggregateResult::LastFailure ( ) const
inline

Referenced by operator AAX_Result().

Here is the caller graph for this function:

◆ NumFailed()

int AAX_AggregateResult::NumFailed ( ) const
inline

◆ NumSucceeded()

int AAX_AggregateResult::NumSucceeded ( ) const
inline

◆ NumAttempted()

int AAX_AggregateResult::NumAttempted ( ) const
inline

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