Microsoft Information Protection (MIP) SDK for C++: Reference 1.16
Doxygen-generated documentation for MIP SDK written in C++
Loading...
Searching...
No Matches
DelegateResponse< T > Class Template Reference

Template class to return delegate operation results. More...

#include <src/api/mip/delegate_response.h>

Inheritance diagram for DelegateResponse< T >:
Collaboration diagram for DelegateResponse< T >:

Public Member Functions

 DelegateResponse (const std::exception_ptr &exception)
 Create a DelegateResponse to wrap returned objects or exceptions.
 
 DelegateResponse (mip::Error &error)
 Create a DelegateResponse to wrap returned objects or exceptions.
 
 DelegateResponse (std::shared_ptr< T > data)
 Create a DelegateResponse to wrap returned objects or exceptions.
 
std::shared_ptr< T > GetData () const
 Returns the requested data, nullptr if call triggered an exception.
 
std::shared_ptr< mip::DelegateResponseError > GetError () const
 Return any error generated during the call, nullptr if call completed successfully.
 

Private Attributes

std::shared_ptr< T > mData
 
std::shared_ptr< mip::DelegateResponseError > mDelegateResponseError
 

Detailed Description

template<class T>
class DelegateResponse< T >

Template class to return delegate operation results.

Definition at line 61 of file delegate_response.h.

Constructor & Destructor Documentation

◆ DelegateResponse() [1/3]

template<class T >
DelegateResponse< T >::DelegateResponse ( std::shared_ptr< T > data)
inline

Create a DelegateResponse to wrap returned objects or exceptions.

Parameters
dataThe type of data that the delegate has created to return wrapped in a shared pointer

Definition at line 68 of file delegate_response.h.

68 : mData(data), mDelegateResponseError(nullptr) {
69 if (!mData) {
70 throw std::invalid_argument("Created an empty DelegateResponse");
71 }
72 }
std::shared_ptr< mip::DelegateResponseError > mDelegateResponseError
std::shared_ptr< T > mData

References DelegateResponse< T >::mData.

◆ DelegateResponse() [2/3]

template<class T >
DelegateResponse< T >::DelegateResponse ( mip::Error & error)
inline

Create a DelegateResponse to wrap returned objects or exceptions.

Parameters
errorThe error that was encountered while processing the delegate

Definition at line 79 of file delegate_response.h.

79 : mData(nullptr), mDelegateResponseError(new DelegateResponseError(error)) {
80 if (mDelegateResponseError->GetMessage().empty()) {
81 throw std::invalid_argument("Created an empty DelegateResponse");
82 }
83 }
Delegate Response Error. Thrown or returned in response to encountering an error in a delegate method...
Definition error.h:315

References DelegateResponse< T >::mDelegateResponseError.

◆ DelegateResponse() [3/3]

template<class T >
DelegateResponse< T >::DelegateResponse ( const std::exception_ptr & exception)
inlineexplicit

Create a DelegateResponse to wrap returned objects or exceptions.

Parameters
exceptionIf the delegate encountered an exception it will populate this field with a exception in a shared pointer

Definition at line 90 of file delegate_response.h.

91 : mData(nullptr),
92 mDelegateResponseError(exception ? new DelegateResponseError(exception) : nullptr) {
94 throw std::invalid_argument("Created an empty DelegateResponse");
95 }
96 }

References DelegateResponse< T >::mDelegateResponseError.

Member Function Documentation

◆ GetData()

template<class T >
std::shared_ptr< T > DelegateResponse< T >::GetData ( ) const
inline

Returns the requested data, nullptr if call triggered an exception.

Returns
The data in a shared pointer of the templated type or nullptr.

Definition at line 103 of file delegate_response.h.

103{ return mData; }

References DelegateResponse< T >::mData.

◆ GetError()

template<class T >
std::shared_ptr< mip::DelegateResponseError > DelegateResponse< T >::GetError ( ) const
inline

Return any error generated during the call, nullptr if call completed successfully.

Returns
Exception pointer due to any failure in the delegate call or nullptr.

Definition at line 110 of file delegate_response.h.

110 {
112 }

References DelegateResponse< T >::mDelegateResponseError.

Member Data Documentation

◆ mData

template<class T >
std::shared_ptr<T> DelegateResponse< T >::mData
private

◆ mDelegateResponseError

template<class T >
std::shared_ptr<mip::DelegateResponseError> DelegateResponse< T >::mDelegateResponseError
private

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