C++ API Reference for Intel® Data Analytics Acceleration Library 2020 Update 1

features/shortcuts.h
1 /* file: shortcuts.h */
2 /*******************************************************************************
3 * Copyright 2014-2020 Intel Corporation
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *******************************************************************************/
17 
18 #ifndef __DATA_MANAGEMENT_FEATURES_SHORTCUTS_H__
19 #define __DATA_MANAGEMENT_FEATURES_SHORTCUTS_H__
20 
21 #include <vector>
22 
23 #include "services/internal/utilities.h"
24 #include "data_management/features/internal/identifiers_impl.h"
25 
26 namespace daal
27 {
28 namespace data_management
29 {
30 namespace features
31 {
35 namespace interface1
36 {
37 
42 class IdFactory : public Base
43 {
44 public:
49  IdFactory(services::Status *status = NULL) :
50  _featureId(internal::NumericFeatureId::create(0, status)) { }
51 
57  IdFactory(int index, services::Status *status = NULL) :
58  _featureId(internal::NumericFeatureId::create(index, status)) { }
59 
65  IdFactory(long index, services::Status *status = NULL) :
66  _featureId(internal::NumericFeatureId::create(index, status)) { }
67 
73  IdFactory(const services::String &name, services::Status *status = NULL) :
74  _featureId(internal::StringFeatureId::create(name, status)) { }
75 
81  IdFactory(const char *name, services::Status *status = NULL) :
82  _featureId(internal::StringFeatureId::create(name, status)) { }
83 
88  const FeatureIdIfacePtr &get() const { return _featureId; }
89 
90 private:
91  FeatureIdIfacePtr _featureId;
92 };
93 
99 inline FeatureIdCollectionIfacePtr list(const IdFactory &id)
100 {
101  using internal::FeatureIdList;
102  using internal::FeatureIdListPtr;
103 
104  FeatureIdListPtr l = FeatureIdList::create();
105  if (l) { l->add(id.get()); }
106  return l;
107 }
108 
115 inline FeatureIdCollectionIfacePtr list(const IdFactory &id1,
116  const IdFactory &id2)
117 {
118  using internal::FeatureIdList;
119  using internal::FeatureIdListPtr;
120 
121  FeatureIdListPtr l = FeatureIdList::create();
122  if (l) { l->add(id1.get()); l->add(id2.get()); }
123  return l;
124 }
125 
133 inline FeatureIdCollectionIfacePtr list(const IdFactory &id1,
134  const IdFactory &id2,
135  const IdFactory &id3)
136 {
137  using internal::FeatureIdList;
138  using internal::FeatureIdListPtr;
139 
140  FeatureIdListPtr l = FeatureIdList::create();
141  if (l) { l->add(id1.get()); l->add(id2.get()); l->add(id3.get()); }
142  return l;
143 }
144 
150 inline FeatureIdCollectionIfacePtr list(const std::vector<IdFactory> &ids)
151 {
152  using internal::FeatureIdList;
153  using internal::FeatureIdListPtr;
154 
155  FeatureIdListPtr l = FeatureIdList::create();
156  for (size_t i = 0; i < ids.size(); i++)
157  {
158  l->add( ids[i].get() );
159  }
160  return l;
161 }
162 
170 inline FeatureIdCollectionIfacePtr range(const IdFactory &begin, const IdFactory &end)
171 {
172  return internal::FeatureIdRange::create(begin.get(), end.get());
173 }
174 
179 inline FeatureIdCollectionIfacePtr all()
180 {
181  return range(0, -1);
182 }
183 
189 inline FeatureIdCollectionIfacePtr allReverse()
190 {
191  return range(-1, 0);
192 }
193 
194 } // namespace interface1
195 
196 using interface1::IdFactory;
197 using interface1::list;
198 using interface1::range;
199 using interface1::all;
200 using interface1::allReverse;
201 
202 } // namespace features
203 } // namespace data_management
204 } // namespace daal
205 
206 #endif
daal::data_management::features::interface1::range
FeatureIdCollectionIfacePtr range(const IdFactory &begin, const IdFactory &end)
Definition: features/shortcuts.h:170
daal::data_management::features::interface1::IdFactory::IdFactory
IdFactory(long index, services::Status *status=NULL)
Definition: features/shortcuts.h:65
daal::Base
Base class for Intel(R) Data Analytics Acceleration Library objects
Definition: base.h:41
daal::data_management::features::internal::FeatureIdList
Implementation of FeatureIdCollection to store a list of feature identifiers.
Definition: identifiers_impl.h:102
daal::data_management::features::interface1::list
FeatureIdCollectionIfacePtr list(const IdFactory &id)
Definition: features/shortcuts.h:99
daal::data_management::features::interface1::all
FeatureIdCollectionIfacePtr all()
Definition: features/shortcuts.h:179
daal::data_management::features::interface1::IdFactory::IdFactory
IdFactory(const services::String &name, services::Status *status=NULL)
Definition: features/shortcuts.h:73
daal::data_management::features::interface1::IdFactory::IdFactory
IdFactory(services::Status *status=NULL)
Definition: features/shortcuts.h:49
daal::data_management::features::interface1::IdFactory::get
const FeatureIdIfacePtr & get() const
Definition: features/shortcuts.h:88
daal::data_management::features::interface1::IdFactory::IdFactory
IdFactory(int index, services::Status *status=NULL)
Definition: features/shortcuts.h:57
daal::data_management::features::interface1::IdFactory
Auxiliary class that simplifies definition of feature ids collections.
Definition: features/shortcuts.h:42
daal::data_management::features::interface1::allReverse
FeatureIdCollectionIfacePtr allReverse()
Definition: features/shortcuts.h:189
daal::data_management::features::interface1::IdFactory::IdFactory
IdFactory(const char *name, services::Status *status=NULL)
Definition: features/shortcuts.h:81

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