CTR Pia  4.11.3
Game Communication Engine
nn::pia::common::CallContext Class Reference

Represents the calling context. More...

+ Inheritance diagram for nn::pia::common::CallContext:

Public Types

typedef void(* CompletionCallback) (nn::Result result, void *pUserArg)
 This typedef defines the callback function that is executed when the asynchronous operation finishes. More...
 

Public Member Functions

 CallContext (void)
 Instantiates the object (constructor). More...
 
 ~CallContext (void)
 Destroys the object. More...
 
void Cancel (void)
 Requests the cancellation of asynchronous processing. More...
 
nn::Result GetResult () const
 Gets the nn::Result value representing the execution result of the asynchronous process. More...
 
bool IsCompleted () const
 Determines whether an asynchronous process has completed. More...
 
bool IsInProgress () const
 Determines whether an asynchronous process is in progress. More...
 
void RegisterCompletionCallback (CompletionCallback pCallback, void *pUserArg=NULL)
 Sets the callback function executed when asynchronous processing completes. More...
 

Detailed Description

Represents the calling context.

The calling context is primarily used to log the execution status of asynchronous functions.


Revision History:

2013-12-16 Removed a previous prohibition on calling the Cancel function in the CallContext passed to the Pia API that does not support cancellations.

2013-12-13 Added the IsInProgress function.

2013-12-13 Made the GetState function private.

2012-09-21 No longer inherits Event.

2012-09-20 Added a description of the conditions under which Cancel can be called.

2012-05-14 Added the CompletionCallback parameter so values can be specified by applications.

2012-05-14 Initial version.

Member Typedef Documentation

typedef void(* nn::pia::common::CallContext::CompletionCallback) (nn::Result result, void *pUserArg)

This typedef defines the callback function that is executed when the asynchronous operation finishes.

Register the callback using the CompletionCallback or RegisterCompletionCallback function so that a callback function is called when asynchronous processing completes.

See also
RegisterCompletionCallback

Constructor & Destructor Documentation

nn::pia::common::CallContext::CallContext ( void  )

Instantiates the object (constructor).

The state is set to Available.

nn::pia::common::CallContext::~CallContext ( void  )

Destroys the object.

The destructor asserts if the CallContext state is CallInProgress when it is called.

Member Function Documentation

void nn::pia::common::CallContext::Cancel ( void  )

Requests the cancellation of asynchronous processing.

Note that calling this API function does not mean that the asynchronous process is canceled immediately. After this API function is called, you must periodically call the IsCompleted function to check the state of completion. Wait until true is returned.

See also
IsCompleted, GetResult
nn::Result nn::pia::common::CallContext::GetResult ( ) const
inline

Gets the nn::Result value representing the execution result of the asynchronous process.

Returns
Returns the nn::Result value of the asynchronous process.
bool nn::pia::common::CallContext::IsCompleted ( ) const
inline

Determines whether an asynchronous process has completed.

Returns
Returns true if the asynchronous process has completed (including cases where it has failed); returns false otherwise.
bool nn::pia::common::CallContext::IsInProgress ( ) const
inline

Determines whether an asynchronous process is in progress.

Returns
Returns true if an asynchronous process is in progress, and false otherwise.
void nn::pia::common::CallContext::RegisterCompletionCallback ( CompletionCallback  pCallback,
void *  pUserArg = NULL 
)

Sets the callback function executed when asynchronous processing completes.

Parameters
[in]pCallbackSpecifies a pointer to the callback function called when asynchronous processing completes.
[in]pUserArgSpecifies the value given in the second argument when calling pCallback.
See also
CompletionCallback