16 #ifndef __SERVICES_INTERNAL_ERROR_HANDLING_HELPERS_H__
17 #define __SERVICES_INTERNAL_ERROR_HANDLING_HELPERS_H__
19 #include "services/error_handling.h"
20 #include "services/daal_shared_ptr.h"
29 inline void tryAssignStatus(Status *status,
const Status &statusToAssign)
31 if (status) { *status |= statusToAssign; }
34 inline void tryAssignStatusAndThrow(Status *status,
const Status &statusToAssign)
38 *status |= statusToAssign;
39 services::throwIfPossible(*status);
43 services::throwIfPossible(statusToAssign);
48 inline SharedPtr<T> wrapShared(T *
object, Status *status = NULL)
52 tryAssignStatus(status, ErrorMemoryAllocationFailed);
54 return SharedPtr<T>(object);
58 inline SharedPtr<T> wrapSharedAndTryThrow(T *
object, Status *status = NULL)
62 tryAssignStatusAndThrow(status, ErrorMemoryAllocationFailed);
64 return SharedPtr<T>(object);
daal
Definition: algorithm_base_common.h:31
daal::services::ErrorMemoryAllocationFailed
Definition: error_indexes.h:147