Line data Source code
1 : /*
2 : * Copyright (c) 2017 Juniper Networks, Inc. All rights reserved.
3 : */
4 : #ifndef __CONFIG__CONFIG_FACTORY_H__
5 : #define __CONFIG__CONFIG_FACTORY_H__
6 :
7 : #include <string>
8 : #include <vector>
9 :
10 : #include <boost/function.hpp>
11 : #include "base/factory.h"
12 :
13 : namespace cass { namespace cql { class CqlIf; } }
14 : using cass::cql::CqlIf;
15 :
16 : namespace etcd { namespace etcdql { class EtcdIf; } }
17 : using etcd::etcdql::EtcdIf;
18 :
19 : class ConfigAmqpChannel;
20 : class ConfigCassandraClient;
21 : class ConfigCassandraPartition;
22 : class ConfigEtcdClient;
23 : class ConfigEtcdPartition;
24 : class ConfigClientManager;
25 : class ConfigJsonParserBase;
26 : struct ConfigClientOptions;
27 : class EventManager;
28 :
29 : struct ConfigStaticObjectFactory : public StaticObjectFactory {
30 :
31 : // The overload for ConfigCassandraClient (because of references)
32 : template <class Base, class T1, class T2, class T3, class T4>
33 : static typename FactoryTypes<Base, T1*, T2*, const T3&, T4>::BasePointer
34 3673 : CreateRef(T1* arg1, T2* arg2, const T3& arg3, T4 arg4) {
35 : return FactoryRecord<Base, T1*, T2*, const T3&, T4>::
36 3673 : create_func_(arg1, arg2, arg3, arg4);
37 : }
38 :
39 : // The overload for CqlIf (because of references)
40 : template <class Base, class T1, class T2, class T3>
41 : static typename FactoryTypes<Base, T1*, const T2&, int, const T3&, const T3&, bool, const T3&, bool>::BasePointer
42 : CreateRef(T1 *arg1, const T2& arg2, int arg3, const T3& arg4, const T3& arg5, bool arg6, const T3&arg7, bool arg8) {
43 : return FactoryRecord<Base, T1*, const T2&, int, const T3&, const T3&, bool, const T3&, bool>::
44 : create_func_(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
45 : }
46 :
47 : // The overload for CqlIf (because of references)
48 : template <class Base, class T1, class T2, class T3>
49 : static typename FactoryTypes<Base, T1*, const T2&, int, const T3&, const T3&, bool, const T3&>::BasePointer
50 3673 : CreateRef(T1 *arg1, const T2& arg2, int arg3, const T3& arg4, const T3& arg5, bool arg6, const T3&arg7) {
51 : return FactoryRecord<Base, T1*, const T2&, int, const T3&, const T3&, bool, const T3&>::
52 3673 : create_func_(arg1, arg2, arg3, arg4, arg5, arg6, arg7);
53 : }
54 :
55 : };
56 :
57 : using ConfigJsonParserRec =
58 : ConfigStaticObjectFactory::FactoryRecord<ConfigJsonParserBase>;
59 :
60 : using ConfigAmqpChannelRec =
61 : ConfigStaticObjectFactory::FactoryRecord<ConfigAmqpChannel>;
62 :
63 : using ConfigCassandraClientRec =
64 : ConfigStaticObjectFactory::FactoryRecord<ConfigCassandraClient,
65 : ConfigClientManager *,
66 : EventManager *,
67 : const ConfigClientOptions &,
68 : int>;
69 :
70 : using ConfigCassandraPartitionRec =
71 : ConfigStaticObjectFactory::FactoryRecord<ConfigCassandraPartition,
72 : ConfigCassandraClient *,
73 : size_t>;
74 :
75 : using CqlIfRec1 =
76 : ConfigStaticObjectFactory::FactoryRecord<CqlIf,
77 : EventManager *,
78 : const std::vector<std::string, std::allocator<std::string>>&,
79 : int,
80 : const std::string &,
81 : const std::string &,
82 : bool,
83 : const std::string &,
84 : bool>;
85 :
86 : using CqlIfRec2 =
87 : ConfigStaticObjectFactory::FactoryRecord<CqlIf,
88 : EventManager *,
89 : const std::vector<std::string, std::allocator<std::string>>&,
90 : int,
91 : const std::string &,
92 : const std::string &,
93 : bool,
94 : const std::string &>;
95 :
96 : //template<> struct ConfigStaticObjectFactory::CastTo<ConfigAmqpChannel> {using BaseType = ConfigAmqpChannel;};
97 :
98 : //To be defined in a corresponding module
99 : //template<> struct ConfigStaticObjectFactory::CastTo<ConfigJsonParser> {using BaseType = ConfigJsonParserBase;};
100 :
101 : //template<> struct ConfigStaticObjectFactory::CastTo<ConfigCassandraClient> {using BaseType = ConfigCassandraClient;};
102 :
103 : //template<> struct ConfigStaticObjectFactory::CastTo<ConfigCassandraPartition> {using BaseType = ConfigCassandraPartition;};
104 :
105 : //template<> struct ConfigStaticObjectFactory::CastTo<CqlIf> {using BaseType = CqlIf;};
106 :
107 : /*
108 : Etcd client was disabled in SConscript
109 : template<> struct ConfigStaticObjectFactory::CastTo<ConfigEtcdClient> {using BaseType = ConfigEtcdClient;};
110 :
111 : template<> struct ConfigStaticObjectFactory::CastTo<ConfigEtcdPartition> {using BaseType = ConfigEtcdPartition;};
112 :
113 : template<> struct ConfigStaticObjectFactory::CastTo<EtcdIf> {using BaseType = EtcdIf;};
114 : */
115 :
116 : #endif // __CONFIG__CONFIG_FACTORY_H__
|