C++ API Reference for Intel® Data Analytics Acceleration Library 2019 Update 4

sorting_batch.h
1 /* file: sorting_batch.h */
2 /*******************************************************************************
3 * Copyright 2014-2019 Intel Corporation.
4 *
5 * This software and the related documents are Intel copyrighted materials, and
6 * your use of them is governed by the express license under which they were
7 * provided to you (License). Unless the License provides otherwise, you may not
8 * use, modify, copy, publish, distribute, disclose or transmit this software or
9 * the related documents without Intel's prior written permission.
10 *
11 * This software and the related documents are provided as is, with no express
12 * or implied warranties, other than those that are expressly stated in the
13 * License.
14 *******************************************************************************/
15 
16 /*
17 //++
18 // Implementation of the interface for the observation sorting algorithm
19 // in the batch processing mode
20 //--
21 */
22 
23 #ifndef __SORTING_BATCH_H__
24 #define __SORTING_BATCH_H__
25 
26 #include "algorithms/algorithm.h"
27 #include "data_management/data/numeric_table.h"
28 #include "services/daal_defines.h"
29 #include "algorithms/sorting/sorting_types.h"
30 
31 namespace daal
32 {
33 namespace algorithms
34 {
35 namespace sorting
36 {
37 
38 namespace interface1
39 {
54 template<typename algorithmFPType, Method method, CpuType cpu>
55 class DAAL_EXPORT BatchContainer : public daal::algorithms::AnalysisContainerIface<batch>
56 {
57 public:
63  BatchContainer(daal::services::Environment::env *daalEnv);
65  virtual ~BatchContainer();
69  virtual services::Status compute() DAAL_C11_OVERRIDE;
70 };
71 
85 template<typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
86 class DAAL_EXPORT Batch : public daal::algorithms::Analysis<batch>
87 {
88 public:
89  typedef algorithms::sorting::Input InputType;
90  typedef algorithms::sorting::Result ResultType;
91 
92  InputType input;
95  Batch()
96  {
97  initialize();
98  }
99 
106  Batch(const Batch<algorithmFPType, method> &other) : input(other.input)
107  {
108  initialize();
109  }
110 
111  virtual ~Batch() {}
112 
117  virtual int getMethod() const DAAL_C11_OVERRIDE { return(int)method; }
118 
123  ResultPtr getResult()
124  {
125  return _result;
126  }
127 
132  services::Status setResult(const ResultPtr &result)
133  {
134  DAAL_CHECK(result, services::ErrorNullResult)
135  _result = result;
136  _res = _result.get();
137  return services::Status();
138  }
139 
145  services::SharedPtr<Batch<algorithmFPType, method> > clone() const
146  {
147  return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
148  }
149 
150 protected:
151  virtual Batch<algorithmFPType, method> *cloneImpl() const DAAL_C11_OVERRIDE
152  {
153  return new Batch<algorithmFPType, method>(*this);
154  }
155 
156  virtual services::Status allocateResult() DAAL_C11_OVERRIDE
157  {
158  services::Status s = _result->allocate<algorithmFPType>(&input, method);
159  _res = _result.get();
160  return s;
161  }
162 
163  void initialize()
164  {
165  Analysis<batch>::_ac = new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
166  _in = &input;
167  _result.reset(new ResultType());
168  }
169 
170  ResultPtr _result;
171 
172 };
174 } // namespace interface1
175 using interface1::BatchContainer;
176 using interface1::Batch;
177 
178 } // namespace daal::algorithms::sorting
179 } // namespace daal::algorithms
180 } // namespace daal
181 #endif
daal::algorithms::sorting::interface1::Batch::getResult
ResultPtr getResult()
Definition: sorting_batch.h:123
daal::algorithms::sorting::interface1::Batch::Batch
Batch()
Definition: sorting_batch.h:95
daal::algorithms::sorting::interface1::BatchContainer
Provides methods to run implementations of the sorting algorithm. It is associated with the daal::alg...
Definition: sorting_batch.h:55
daal
Definition: algorithm_base_common.h:31
daal::algorithms::AnalysisContainerIface
Abstract interface class that provides virtual methods to access and run implementations of the analy...
Definition: analysis.h:53
daal::algorithms::sorting::interface1::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: sorting_batch.h:117
daal_defines.h
daal::algorithms::sorting::interface1::Batch::input
InputType input
Definition: sorting_batch.h:92
daal::algorithms::sorting::interface1::Batch::Batch
Batch(const Batch< algorithmFPType, method > &other)
Definition: sorting_batch.h:106
daal::batch
Definition: daal_defines.h:110
daal::algorithms::sorting::interface1::Batch::clone
services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: sorting_batch.h:145
daal::algorithms::Analysis
Provides methods for execution of operations over data, such as computation of Summary Statistics est...
Definition: analysis.h:68
daal::algorithms::sorting::interface1::Batch::setResult
services::Status setResult(const ResultPtr &result)
Definition: sorting_batch.h:132
daal::algorithms::sorting::interface1::Batch
Sorts the datasets by components of the random vector in the batch processing mode.
Definition: sorting_batch.h:86
daal::services::ErrorNullResult
Definition: error_indexes.h:96

For more complete information about compiler optimizations, see our Optimization Notice.