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

features/shortcuts.h
1 /* file: shortcuts.h */
2 /*******************************************************************************
3 * Copyright 2014-2018 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 #ifndef __DATA_MANAGEMENT_FEATURES_SHORTCUTS_H__
17 #define __DATA_MANAGEMENT_FEATURES_SHORTCUTS_H__
18 
19 #include <vector>
20 
21 #include "services/internal/utilities.h"
22 #include "data_management/features/internal/identifiers_impl.h"
23 
24 namespace daal
25 {
26 namespace data_management
27 {
28 namespace features
29 {
33 namespace interface1
34 {
35 
40 class IdFactory : public Base
41 {
42 public:
47  IdFactory(services::Status *status = NULL) :
48  _featureId(internal::NumericFeatureId::create(0, status)) { }
49 
55  IdFactory(int index, services::Status *status = NULL) :
56  _featureId(internal::NumericFeatureId::create(index, status)) { }
57 
63  IdFactory(long index, services::Status *status = NULL) :
64  _featureId(internal::NumericFeatureId::create(index, status)) { }
65 
71  IdFactory(const services::String &name, services::Status *status = NULL) :
72  _featureId(internal::StringFeatureId::create(name, status)) { }
73 
79  IdFactory(const char *name, services::Status *status = NULL) :
80  _featureId(internal::StringFeatureId::create(name, status)) { }
81 
86  const FeatureIdIfacePtr &get() const { return _featureId; }
87 
88 private:
89  FeatureIdIfacePtr _featureId;
90 };
91 
97 inline FeatureIdCollectionIfacePtr list(const IdFactory &id)
98 {
99  using internal::FeatureIdList;
100  using internal::FeatureIdListPtr;
101 
102  FeatureIdListPtr l = FeatureIdList::create();
103  if (l) { l->add(id.get()); }
104  return l;
105 }
106 
113 inline FeatureIdCollectionIfacePtr list(const IdFactory &id1,
114  const IdFactory &id2)
115 {
116  using internal::FeatureIdList;
117  using internal::FeatureIdListPtr;
118 
119  FeatureIdListPtr l = FeatureIdList::create();
120  if (l) { l->add(id1.get()); l->add(id2.get()); }
121  return l;
122 }
123 
131 inline FeatureIdCollectionIfacePtr list(const IdFactory &id1,
132  const IdFactory &id2,
133  const IdFactory &id3)
134 {
135  using internal::FeatureIdList;
136  using internal::FeatureIdListPtr;
137 
138  FeatureIdListPtr l = FeatureIdList::create();
139  if (l) { l->add(id1.get()); l->add(id2.get()); l->add(id3.get()); }
140  return l;
141 }
142 
148 inline FeatureIdCollectionIfacePtr list(const std::vector<IdFactory> &ids)
149 {
150  using internal::FeatureIdList;
151  using internal::FeatureIdListPtr;
152 
153  FeatureIdListPtr l = FeatureIdList::create();
154  for (size_t i = 0; i < ids.size(); i++)
155  {
156  l->add( ids[i].get() );
157  }
158  return l;
159 }
160 
168 inline FeatureIdCollectionIfacePtr range(const IdFactory &begin, const IdFactory &end)
169 {
170  return internal::FeatureIdRange::create(begin.get(), end.get());
171 }
172 
177 inline FeatureIdCollectionIfacePtr all()
178 {
179  return range(0, -1);
180 }
181 
187 inline FeatureIdCollectionIfacePtr allReverse()
188 {
189  return range(-1, 0);
190 }
191 
192 } // namespace interface1
193 
194 using interface1::IdFactory;
195 using interface1::list;
196 using interface1::range;
197 using interface1::all;
198 using interface1::allReverse;
199 
200 } // namespace features
201 } // namespace data_management
202 } // namespace daal
203 
204 #endif
daal
Definition: algorithm_base_common.h:31
daal::data_management::features::interface1::IdFactory::get
const FeatureIdIfacePtr & get() const
Definition: features/shortcuts.h:86
daal::data_management::features::interface1::IdFactory
Auxiliary class that simplifies definition of feature ids collections.
Definition: features/shortcuts.h:40
daal::data_management::features::interface1::IdFactory::IdFactory
IdFactory(int index, services::Status *status=NULL)
Definition: features/shortcuts.h:55
daal::data_management::features::interface1::allReverse
FeatureIdCollectionIfacePtr allReverse()
Definition: features/shortcuts.h:187
daal::data_management::features::interface1::IdFactory::IdFactory
IdFactory(long index, services::Status *status=NULL)
Definition: features/shortcuts.h:63
daal::data_management::features::interface1::all
FeatureIdCollectionIfacePtr all()
Definition: features/shortcuts.h:177
daal::data_management::features::interface1::range
FeatureIdCollectionIfacePtr range(const IdFactory &begin, const IdFactory &end)
Definition: features/shortcuts.h:168
daal::data_management::features::internal::FeatureIdList
Implementation of FeatureIdCollection to store a list of feature identifiers.
Definition: identifiers_impl.h:100
daal::Base
Base class for Intel(R) Data Analytics Acceleration Library objects
Definition: base.h:39
daal::data_management::features::interface1::list
FeatureIdCollectionIfacePtr list(const IdFactory &id)
Definition: features/shortcuts.h:97
daal::data_management::features::interface1::IdFactory::IdFactory
IdFactory(const services::String &name, services::Status *status=NULL)
Definition: features/shortcuts.h:71
daal::data_management::features::interface1::IdFactory::IdFactory
IdFactory(const char *name, services::Status *status=NULL)
Definition: features/shortcuts.h:79
daal::data_management::features::interface1::IdFactory::IdFactory
IdFactory(services::Status *status=NULL)
Definition: features/shortcuts.h:47

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