33#ifndef API_MIP_DELEGATE_RESPONSE
34#define API_MIP_DELEGATE_RESPONSE
46class DelegateResponseBase {
49 DelegateResponseBase() : mReserved(0) {}
52 static long GetReserved(
const DelegateResponseBase& response) {
53 return response.mReserved;
61template <
class T>
class DelegateResponse :
public DelegateResponseBase {
68 DelegateResponse(std::shared_ptr<T> data) : mData(data), mDelegateResponseError(nullptr) {
70 throw std::invalid_argument(
"Created an empty DelegateResponse");
79 DelegateResponse(mip::Error& error) : mData(nullptr), mDelegateResponseError(new
DelegateResponseError(error)) {
80 if (mDelegateResponseError->GetMessage().empty()) {
81 throw std::invalid_argument(
"Created an empty DelegateResponse");
90 explicit DelegateResponse(
const std::exception_ptr& exception)
93 if (!mDelegateResponseError) {
94 throw std::invalid_argument(
"Created an empty DelegateResponse");
103 std::shared_ptr<T> GetData()
const {
return mData; }
110 std::shared_ptr<mip::DelegateResponseError> GetError()
const {
111 return mDelegateResponseError;
115 virtual ~DelegateResponse() {}
117 DelegateResponse() {}
121 std::shared_ptr<T> mData;
122 std::shared_ptr<mip::DelegateResponseError> mDelegateResponseError;
A file containing the MIP SDK error types.