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

factory.h
1 /* file: factory.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 /*
19 //++
20 // Implementation of service features used by the library components.
21 //--
22 */
23 
24 #ifndef __FACTORY_H__
25 #define __FACTORY_H__
26 
27 #include "services/daal_defines.h"
28 #include "data_management/data/data_serialize.h"
29 #include "data_management/data/data_collection.h"
30 
31 namespace daal
32 {
33 namespace data_management
34 {
35 
36 namespace interface1
37 {
46 class DAAL_EXPORT AbstractCreator
47 {
48 public:
49  DAAL_NEW_DELETE();
50 
52  AbstractCreator() {}
53 
55  virtual ~AbstractCreator() {}
56 
61  virtual SerializationIface *create() const = 0;
62 
67  virtual int getTag() const = 0;
68 };
69 
70 
77 template <class Derived>
78 class Creator : public AbstractCreator
79 {
80 public:
82  Creator() {}
83 
85  virtual ~Creator() {}
86 
87  SerializationIface *create() const DAAL_C11_OVERRIDE
88  {
89  return new Derived();
90  }
91 
92  int getTag() const DAAL_C11_OVERRIDE
93  {
94  return Derived::serializationTag();
95  }
96 };
97 
98 class FactoryImpl;
99 
105 class DAAL_EXPORT Factory
106 {
107 public:
112  static Factory &instance();
113 
118  void registerObject(AbstractCreator *creator);
119 
124  SerializationIface *createObject(int objectId);
125 
126 private:
127  Factory();
128  Factory(const Factory &);
129  Factory &operator = (const Factory &);
130  ~Factory();
131  FactoryImpl *_impl;
132 };
134 } // namespace interface1
135 using interface1::AbstractCreator;
136 using interface1::Creator;
137 using interface1::Factory;
138 
139 }
140 } // namespace daal
141 #endif
daal::data_management::interface1::AbstractCreator::AbstractCreator
AbstractCreator()
Definition: factory.h:52
daal::data_management::interface1::Creator::getTag
int getTag() const DAAL_C11_OVERRIDE
Definition: factory.h:92
daal::data_management::interface1::Creator::Creator
Creator()
Definition: factory.h:82
daal::data_management::interface1::Factory
Class that provides factory functionality for objects implementing the SerializationIface interface...
Definition: factory.h:105
daal_defines.h
daal::data_management::interface1::SerializationIface
Abstract interface class that defines the interface for serialization and deserialization.
Definition: data_serialize.h:52
daal::data_management::interface1::Creator::create
SerializationIface * create() const DAAL_C11_OVERRIDE
Definition: factory.h:87
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:78
daal::data_management::interface1::AbstractCreator
Interface class used by the Factory class to register and create objects of a specific class...
Definition: factory.h:46

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