AAX SDK  2.4.1
Avid Audio Extensions Development Kit
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:502
Definition: AAX_Exception.h:592

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:317
AAX_Result LastFailure() const
Definition: AAX_Exception.h:623

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 ()
 
 ~AAX_AggregateResult ()
 
AAX_AggregateResultoperator= (AAX_Result inResult)
 Overloaded operator=() for conversion from AAX_Result. More...
 
AAX_Result LastFailure () const
 
int NumFailed () const
 
int NumSucceeded () const
 
int NumAttempted () const
 

Constructor & Destructor Documentation

◆ AAX_AggregateResult()

AAX_AggregateResult::AAX_AggregateResult ( )
inline

◆ ~AAX_AggregateResult()

AAX_AggregateResult::~AAX_AggregateResult ( )
inline

Member Function Documentation

◆ operator=()

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

Overloaded operator=() for conversion from AAX_Result.

References AAX_SUCCESS.

◆ LastFailure()

AAX_Result AAX_AggregateResult::LastFailure ( ) const
inline

◆ 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: