C++ API Reference for Intel® Data Analytics Acceleration Library 2018 Update 2

factory.h
1 /* file: factory.h */
2 /*******************************************************************************
3 * Copyright 2014-2018 Intel Corporation
4 * All Rights Reserved.
5 *
6 * If this software was obtained under the Intel Simplified Software License,
7 * the following terms apply:
8 *
9 * The source code, information and material ("Material") contained herein is
10 * owned by Intel Corporation or its suppliers or licensors, and title to such
11 * Material remains with Intel Corporation or its suppliers or licensors. The
12 * Material contains proprietary information of Intel or its suppliers and
13 * licensors. The Material is protected by worldwide copyright laws and treaty
14 * provisions. No part of the Material may be used, copied, reproduced,
15 * modified, published, uploaded, posted, transmitted, distributed or disclosed
16 * in any way without Intel's prior express written permission. No license under
17 * any patent, copyright or other intellectual property rights in the Material
18 * is granted to or conferred upon you, either expressly, by implication,
19 * inducement, estoppel or otherwise. Any license under such intellectual
20 * property rights must be express and approved by Intel in writing.
21 *
22 * Unless otherwise agreed by Intel in writing, you may not remove or alter this
23 * notice or any other notice embedded in Materials by Intel or Intel's
24 * suppliers or licensors in any way.
25 *
26 *
27 * If this software was obtained under the Apache License, Version 2.0 (the
28 * "License"), the following terms apply:
29 *
30 * You may not use this file except in compliance with the License. You may
31 * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
32 *
33 *
34 * Unless required by applicable law or agreed to in writing, software
35 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
36 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
37 *
38 * See the License for the specific language governing permissions and
39 * limitations under the License.
40 *******************************************************************************/
41 
42 /*
43 //++
44 // Implementation of service features used by the library components.
45 //--
46 */
47 
48 #ifndef __FACTORY_H__
49 #define __FACTORY_H__
50 
51 #include "services/daal_defines.h"
52 #include "data_management/data/data_serialize.h"
53 #include "data_management/data/data_collection.h"
54 
55 namespace daal
56 {
57 namespace data_management
58 {
59 
60 namespace interface1
61 {
70 class DAAL_EXPORT AbstractCreator
71 {
72 public:
73  DAAL_NEW_DELETE();
74 
76  AbstractCreator() {}
77 
79  virtual ~AbstractCreator() {}
80 
85  virtual SerializationIface *create() const = 0;
86 
91  virtual int getTag() const = 0;
92 };
93 
94 
101 template <class Derived>
102 class Creator : public AbstractCreator
103 {
104 public:
106  Creator() {}
107 
109  virtual ~Creator() {}
110 
111  SerializationIface *create() const DAAL_C11_OVERRIDE
112  {
113  return new Derived();
114  }
115 
116  int getTag() const DAAL_C11_OVERRIDE
117  {
118  return Derived::serializationTag();
119  }
120 };
121 
122 class FactoryImpl;
123 
129 class DAAL_EXPORT Factory
130 {
131 public:
136  static Factory &instance();
137 
142  void registerObject(AbstractCreator *creator);
143 
148  SerializationIface *createObject(int objectId);
149 
150 private:
151  Factory();
152  Factory(const Factory &);
153  Factory &operator = (const Factory &);
154  ~Factory();
155  FactoryImpl *_impl;
156 };
158 } // namespace interface1
159 using interface1::AbstractCreator;
160 using interface1::Creator;
161 using interface1::Factory;
162 
163 }
164 } // namespace daal
165 #endif
daal
Definition: algorithm_base_common.h:57
daal::data_management::interface1::Factory
Class that provides factory functionality for objects implementing the SerializationIface interface...
Definition: factory.h:129
daal::data_management::interface1::Creator
Main class used by the Factory class to register and create objects of a class derived from Serializa...
Definition: factory.h:102
daal::data_management::interface1::Creator::Creator
Creator()
Definition: factory.h:106
daal::data_management::interface1::Creator::create
SerializationIface * create() const DAAL_C11_OVERRIDE
Definition: factory.h:111
daal_defines.h
daal::data_management::interface1::Creator::getTag
int getTag() const DAAL_C11_OVERRIDE
Definition: factory.h:116
daal::data_management::interface1::AbstractCreator::AbstractCreator
AbstractCreator()
Definition: factory.h:76
daal::data_management::interface1::SerializationIface
Abstract interface class that defines the interface for serialization and deserialization.
Definition: data_serialize.h:76
daal::data_management::interface1::AbstractCreator
Interface class used by the Factory class to register and create objects of a specific class...
Definition: factory.h:70

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