48 #ifndef __ALGORITHM_BASE_COMMON_H__ 49 #define __ALGORITHM_BASE_COMMON_H__ 51 #include "services/daal_memory.h" 52 #include "services/daal_kernel_defines.h" 53 #include "services/error_handling.h" 54 #include "services/env_detect.h" 55 #include "algorithms/algorithm_types.h" 80 virtual ~AlgorithmIface() {}
85 virtual services::Status checkComputeParams() = 0;
90 virtual services::Status checkResult() = 0;
96 virtual int getMethod()
const = 0;
103 virtual services::SharedPtr<services::ErrorCollection> getErrors() = 0;
111 class AlgorithmIfaceImpl :
public AlgorithmIface
115 AlgorithmIfaceImpl() : _enableChecks(true)
120 virtual ~AlgorithmIfaceImpl() {}
126 void enableChecks(
bool enableChecksFlag)
128 _enableChecks = enableChecksFlag;
135 bool isChecksEnabled()
const 137 return _enableChecks;
145 services::SharedPtr<services::ErrorCollection> getErrors()
147 return _status.getCollection();
154 services::Status getEnvironment()
156 int cpuid = (int)daal::services::Environment::getInstance()->getCpuId();
158 return services::Status(services::ErrorCpuNotSupported);
160 _env.cpuid_init_flag =
true;
161 return services::Status();
164 daal::services::Environment::env _env;
165 services::Status _status;
170 using interface1::AlgorithmIface;
171 using interface1::AlgorithmIfaceImpl;
daal::services::ErrorCpuNotSupported
Definition: error_indexes.h:171
daal::services::interface1::Environment::getCpuId
int getCpuId(int enable=cpu_default)
daal::services::interface1::Environment::_envStruct
The environment structure.
Definition: env_detect.h:95
daal::services::interface1::Status
Class that holds the results of API calls. In case of API routine failure it contains the list of err...
Definition: error_handling.h:491
daal
Definition: algorithm_base_common.h:57
daal::services::interface1::Environment::getInstance
static Environment * getInstance()
daal::algorithms::interface1::AlgorithmIfaceImpl::isChecksEnabled
bool isChecksEnabled() const
Definition: algorithm_base_common.h:135
daal::algorithms::interface1::AlgorithmIface
Abstract class which defines interface for the library component related to data processing involving...
Definition: algorithm_base_common.h:75
daal::algorithms::interface1::AlgorithmIfaceImpl::AlgorithmIfaceImpl
AlgorithmIfaceImpl()
Definition: algorithm_base_common.h:115
daal::services::interface1::SharedPtr
Shared pointer that retains shared ownership of an object through a pointer. Several SharedPtr object...
Definition: daal_shared_ptr.h:187
daal::algorithms::interface1::AlgorithmIfaceImpl
Implements the abstract interface AlgorithmIface. AlgorithmIfaceImpl is, in turn, the base class for ...
Definition: algorithm_base_common.h:111
daal::algorithms::interface1::AlgorithmIface::checkResult
virtual services::Status checkResult()=0
daal::algorithms::interface1::AlgorithmIface::getErrors
virtual services::SharedPtr< services::ErrorCollection > getErrors()=0
daal::algorithms::interface1::AlgorithmIfaceImpl::getErrors
services::SharedPtr< services::ErrorCollection > getErrors()
Definition: algorithm_base_common.h:145
daal::algorithms::interface1::AlgorithmIfaceImpl::enableChecks
void enableChecks(bool enableChecksFlag)
Definition: algorithm_base_common.h:126
daal::algorithms::interface1::AlgorithmIface::checkComputeParams
virtual services::Status checkComputeParams()=0
daal::algorithms::interface1::AlgorithmIface::getMethod
virtual int getMethod() const =0