Lucene++ - a full-featured, c++ search engine
API Documentation

- Main Page
- Related Pages
- Namespaces
- Data Structures
- Files

- File List
- Globals

All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
LuceneFactory.h
Go to the documentation of this file.
1 // Copyright (c) 2009-2011 Alan Wright. All rights reserved.
3 // Distributable under the terms of either the Apache License (Version 2.0)
4 // or the GNU Lesser General Public License.
6
7 #ifndef LUCENEFACTORY_H
8 #define LUCENEFACTORY_H
9
10 #include <boost/make_shared.hpp>
11 #include <boost/version.hpp>
12
13 namespace Lucene
14 {
15 template <class T>
16 boost::shared_ptr<T> newInstance()
17 {
18 #if BOOST_VERSION <= 103800
19 return boost::shared_ptr<T>(new T);
20 #else
21 return boost::allocate_shared<T>(LuceneAllocator<T>());
22 #endif
23 }
24
25 template <class T, class A1>
26 boost::shared_ptr<T> newInstance(A1 const& a1)
27 {
28 #if BOOST_VERSION <= 103800
29 return boost::shared_ptr<T>(new T(a1));
30 #else
31 return boost::allocate_shared<T>(LuceneAllocator<T>(), a1);
32 #endif
33 }
34
35 template <class T, class A1, class A2>
36 boost::shared_ptr<T> newInstance(A1 const& a1, A2 const& a2)
37 {
38 #if BOOST_VERSION <= 103800
39 return boost::shared_ptr<T>(new T(a1, a2));
40 #else
41 return boost::allocate_shared<T>(LuceneAllocator<T>(), a1, a2);
42 #endif
43 }
44
45 template <class T, class A1, class A2, class A3>
46 boost::shared_ptr<T> newInstance(A1 const& a1, A2 const& a2, A3 const& a3)
47 {
48 #if BOOST_VERSION <= 103800
49 return boost::shared_ptr<T>(new T(a1, a2, a3));
50 #else
51 return boost::allocate_shared<T>(LuceneAllocator<T>(), a1, a2, a3);
52 #endif
53 }
54
55 template <class T, class A1, class A2, class A3, class A4>
56 boost::shared_ptr<T> newInstance(A1 const& a1, A2 const& a2, A3 const& a3, A4 const& a4)
57 {
58 #if BOOST_VERSION <= 103800
59 return boost::shared_ptr<T>(new T(a1, a2, a3, a4));
60 #else
61 return boost::allocate_shared<T>(LuceneAllocator<T>(), a1, a2, a3, a4);
62 #endif
63 }
64
65 template <class T, class A1, class A2, class A3, class A4, class A5>
66 boost::shared_ptr<T> newInstance(A1 const& a1, A2 const& a2, A3 const& a3, A4 const& a4, A5 const& a5)
67 {
68 #if BOOST_VERSION <= 103800
69 return boost::shared_ptr<T>(new T(a1, a2, a3, a4, a5));
70 #else
71 return boost::allocate_shared<T>(LuceneAllocator<T>(), a1, a2, a3, a4, a5);
72 #endif
73 }
74
75 template <class T, class A1, class A2, class A3, class A4, class A5, class A6>
76 boost::shared_ptr<T> newInstance(A1 const& a1, A2 const& a2, A3 const& a3, A4 const& a4, A5 const& a5, A6 const& a6)
77 {
78 #if BOOST_VERSION <= 103800
79 return boost::shared_ptr<T>(new T(a1, a2, a3, a4, a5, a6));
80 #else
81 return boost::allocate_shared<T>(LuceneAllocator<T>(), a1, a2, a3, a4, a5, a6);
82 #endif
83 }
84
85 template <class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7>
86 boost::shared_ptr<T> newInstance(A1 const& a1, A2 const& a2, A3 const& a3, A4 const& a4, A5 const& a5, A6 const& a6, A7 const& a7)
87 {
88 #if BOOST_VERSION <= 103800
89 return boost::shared_ptr<T>(new T(a1, a2, a3, a4, a5, a6, a7));
90 #else
91 return boost::allocate_shared<T>(LuceneAllocator<T>(), a1, a2, a3, a4, a5, a6, a7);
92 #endif
93 }
94
95 template <class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
96 boost::shared_ptr<T> newInstance(A1 const& a1, A2 const& a2, A3 const& a3, A4 const& a4, A5 const& a5, A6 const& a6, A7 const& a7, A8 const& a8)
97 {
98 #if BOOST_VERSION <= 103800
99 return boost::shared_ptr<T>(new T(a1, a2, a3, a4, a5, a6, a7, a8));
100 #else
101 return boost::allocate_shared<T>(LuceneAllocator<T>(), a1, a2, a3, a4, a5, a6, a7, a8);
102 #endif
103 }
104
105 template <class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9>
106 boost::shared_ptr<T> newInstance(A1 const& a1, A2 const& a2, A3 const& a3, A4 const& a4, A5 const& a5, A6 const& a6, A7 const& a7, A8 const& a8, A9 const& a9)
107 {
108 #if BOOST_VERSION <= 103800
109 return boost::shared_ptr<T>(new T(a1, a2, a3, a4, a5, a6, a7, a8, a9));
110 #else
111 return boost::allocate_shared<T>(LuceneAllocator<T>(), a1, a2, a3, a4, a5, a6, a7, a8, a9);
112 #endif
113 }
114
115 template <class T>
116 boost::shared_ptr<T> newLucene()
117 {
118 boost::shared_ptr<T> instance(newInstance<T>());
119 instance->initialize();
120 return instance;
121 }
122
123 template <class T, class A1>
124 boost::shared_ptr<T> newLucene(A1 const& a1)
125 {
126 boost::shared_ptr<T> instance(newInstance<T>(a1));
127 instance->initialize();
128 return instance;
129 }
130
131 template <class T, class A1, class A2>
132 boost::shared_ptr<T> newLucene(A1 const& a1, A2 const& a2)
133 {
134 boost::shared_ptr<T> instance(newInstance<T>(a1, a2));
135 instance->initialize();
136 return instance;
137 }
138
139 template <class T, class A1, class A2, class A3>
140 boost::shared_ptr<T> newLucene(A1 const& a1, A2 const& a2, A3 const& a3)
141 {
142 boost::shared_ptr<T> instance(newInstance<T>(a1, a2, a3));
143 instance->initialize();
144 return instance;
145 }
146
147 template <class T, class A1, class A2, class A3, class A4>
148 boost::shared_ptr<T> newLucene(A1 const& a1, A2 const& a2, A3 const& a3, A4 const& a4)
149 {
150 boost::shared_ptr<T> instance(newInstance<T>(a1, a2, a3, a4));
151 instance->initialize();
152 return instance;
153 }
154
155 template <class T, class A1, class A2, class A3, class A4, class A5>
156 boost::shared_ptr<T> newLucene(A1 const& a1, A2 const& a2, A3 const& a3, A4 const& a4, A5 const& a5)
157 {
158 boost::shared_ptr<T> instance(newInstance<T>(a1, a2, a3, a4, a5));
159 instance->initialize();
160 return instance;
161 }
162
163 template <class T, class A1, class A2, class A3, class A4, class A5, class A6>
164 boost::shared_ptr<T> newLucene(A1 const& a1, A2 const& a2, A3 const& a3, A4 const& a4, A5 const& a5, A6 const& a6)
165 {
166 boost::shared_ptr<T> instance(newInstance<T>(a1, a2, a3, a4, a5, a6));
167 instance->initialize();
168 return instance;
169 }
170
171 template <class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7>
172 boost::shared_ptr<T> newLucene(A1 const& a1, A2 const& a2, A3 const& a3, A4 const& a4, A5 const& a5, A6 const& a6, A7 const& a7)
173 {
174 boost::shared_ptr<T> instance(newInstance<T>(a1, a2, a3, a4, a5, a6, a7));
175 instance->initialize();
176 return instance;
177 }
178
179 template <class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
180 boost::shared_ptr<T> newLucene(A1 const& a1, A2 const& a2, A3 const& a3, A4 const& a4, A5 const& a5, A6 const& a6, A7 const& a7, A8 const& a8)
181 {
182 boost::shared_ptr<T> instance(newInstance<T>(a1, a2, a3, a4, a5, a6, a7, a8));
183 instance->initialize();
184 return instance;
185 }
186
187 template <class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9>
188 boost::shared_ptr<T> newLucene(A1 const& a1, A2 const& a2, A3 const& a3, A4 const& a4, A5 const& a5, A6 const& a6, A7 const& a7, A8 const& a8, A9 const& a9)
189 {
190 boost::shared_ptr<T> instance(newInstance<T>(a1, a2, a3, a4, a5, a6, a7, a8, a9));
191 instance->initialize();
192 return instance;
193 }
194 }
195
196 #endif

clucene.sourceforge.net