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

factory.h
1 /* file: factory.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 service features used by the library components.
19 //--
20 */
21 
22 #ifndef __FACTORY_H__
23 #define __FACTORY_H__
24 
25 #include "services/daal_defines.h"
26 #include "data_management/data/data_serialize.h"
27 #include "data_management/data/data_collection.h"
28 
29 namespace daal
30 {
31 namespace data_management
32 {
33 
34 namespace interface1
35 {
44 class DAAL_EXPORT AbstractCreator
45 {
46 public:
47  DAAL_NEW_DELETE();
48 
50  AbstractCreator() {}
51 
53  virtual ~AbstractCreator() {}
54 
59  virtual SerializationIface *create() const = 0;
60 
65  virtual int getTag() const = 0;
66 };
67 
68 
75 template <class Derived>
76 class Creator : public AbstractCreator
77 {
78 public:
80  Creator() {}
81 
83  virtual ~Creator() {}
84 
85  SerializationIface *create() const DAAL_C11_OVERRIDE
86  {
87  return new Derived();
88  }
89 
90  int getTag() const DAAL_C11_OVERRIDE
91  {
92  return Derived::serializationTag();
93  }
94 };
95 
96 class FactoryImpl;
97 
103 class DAAL_EXPORT Factory
104 {
105 public:
110  static Factory &instance();
111 
116  void registerObject(AbstractCreator *creator);
117 
122  SerializationIface *createObject(int objectId);
123 
124 private:
125  Factory();
126  Factory(const Factory &);
127  Factory &operator = (const Factory &);
128  ~Factory();
129  FactoryImpl *_impl;
130 };
132 } // namespace interface1
133 using interface1::AbstractCreator;
134 using interface1::Creator;
135 using interface1::Factory;
136 
137 }
138 } // namespace daal
139 #endif
daal
Definition: algorithm_base_common.h:31
daal::data_management::interface1::Factory
Class that provides factory functionality for objects implementing the SerializationIface interface...
Definition: factory.h:103
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:76
daal::data_management::interface1::Creator::Creator
Creator()
Definition: factory.h:80
daal::data_management::interface1::Creator::create
SerializationIface * create() const DAAL_C11_OVERRIDE
Definition: factory.h:85
daal_defines.h
daal::data_management::interface1::Creator::getTag
int getTag() const DAAL_C11_OVERRIDE
Definition: factory.h:90
daal::data_management::interface1::AbstractCreator::AbstractCreator
AbstractCreator()
Definition: factory.h:50
daal::data_management::interface1::SerializationIface
Abstract interface class that defines the interface for serialization and deserialization.
Definition: data_serialize.h:50
daal::data_management::interface1::AbstractCreator
Interface class used by the Factory class to register and create objects of a specific class...
Definition: factory.h:44

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