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

Loading...
Searching...
No Matches
LuceneFactory.h
Go to the documentation of this file.
1
2// Copyright (c) 2009-2014 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>
16boost::shared_ptr<T> newInstance() {
17#if BOOST_VERSION <= 103800
18 return boost::shared_ptr<T>(new T);
19#else
20 return boost::make_shared<T>();
21#endif
22}
23
24 template <class T, class A1>
25boost::shared_ptr<T> newInstance(A1 const& a1) {
26#if BOOST_VERSION <= 103800
27 return boost::shared_ptr<T>(new T(a1));
28#else
29 return boost::make_shared<T>(a1);
30#endif
31}
32
33 template <class T, class A1, class A2>
34boost::shared_ptr<T> newInstance(A1 const& a1, A2 const& a2) {
35#if BOOST_VERSION <= 103800
36 return boost::shared_ptr<T>(new T(a1, a2));
37#else
38 return boost::make_shared<T>(a1, a2);
39#endif
40}
41
42 template <class T, class A1, class A2, class A3>
43boost::shared_ptr<T> newInstance(A1 const& a1, A2 const& a2, A3 const& a3) {
44#if BOOST_VERSION <= 103800
45 return boost::shared_ptr<T>(new T(a1, a2, a3));
46#else
47 return boost::make_shared<T>(a1, a2, a3);
48#endif
49}
50
51 template <class T, class A1, class A2, class A3, class A4>
52boost::shared_ptr<T> newInstance(A1 const& a1, A2 const& a2, A3 const& a3, A4 const& a4) {
53#if BOOST_VERSION <= 103800
54 return boost::shared_ptr<T>(new T(a1, a2, a3, a4));
55#else
56 return boost::make_shared<T>(a1, a2, a3, a4);
57#endif
58}
59
60 template <class T, class A1, class A2, class A3, class A4, class A5>
61boost::shared_ptr<T> newInstance(A1 const& a1, A2 const& a2, A3 const& a3, A4 const& a4, A5 const& a5) {
62#if BOOST_VERSION <= 103800
63 return boost::shared_ptr<T>(new T(a1, a2, a3, a4, a5));
64#else
65 return boost::make_shared<T>(a1, a2, a3, a4, a5);
66#endif
67}
68
69 template <class T, class A1, class A2, class A3, class A4, class A5, class A6>
70boost::shared_ptr<T> newInstance(A1 const& a1, A2 const& a2, A3 const& a3, A4 const& a4, A5 const& a5, A6 const& a6) {
71#if BOOST_VERSION <= 103800
72 return boost::shared_ptr<T>(new T(a1, a2, a3, a4, a5, a6));
73#else
74 return boost::make_shared<T>(a1, a2, a3, a4, a5, a6);
75#endif
76}
77
78 template <class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7>
79boost::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) {
80#if BOOST_VERSION <= 103800
81 return boost::shared_ptr<T>(new T(a1, a2, a3, a4, a5, a6, a7));
82#else
83 return boost::make_shared<T>(a1, a2, a3, a4, a5, a6, a7);
84#endif
85}
86
87 template <class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
88boost::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) {
89#if BOOST_VERSION <= 103800
90 return boost::shared_ptr<T>(new T(a1, a2, a3, a4, a5, a6, a7, a8));
91#else
92 return boost::make_shared<T>(a1, a2, a3, a4, a5, a6, a7, a8);
93#endif
94}
95
96 template <class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9>
97boost::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) {
98#if BOOST_VERSION <= 103800
99 return boost::shared_ptr<T>(new T(a1, a2, a3, a4, a5, a6, a7, a8, a9));
100#else
101 return boost::make_shared<T>(a1, a2, a3, a4, a5, a6, a7, a8, a9);
102#endif
103}
104
105 template <class T>
106boost::shared_ptr<T> newLucene() {
107#if BOOST_VERSION <= 103800
108 boost::shared_ptr<T> instance = boost::shared_ptr<T>(new T);
109#else
110 boost::shared_ptr<T> instance = boost::make_shared<T>();
111#endif
112 instance->initialize();
113 return instance;
114}
115
116 template <class T, class A1>
117boost::shared_ptr<T> newLucene(A1 const& a1) {
118 boost::shared_ptr<T> instance(newInstance<T>(a1));
119 instance->initialize();
120 return instance;
121}
122
123 template <class T, class A1, class A2>
124boost::shared_ptr<T> newLucene(A1 const& a1, A2 const& a2) {
125 boost::shared_ptr<T> instance(newInstance<T>(a1, a2));
126 instance->initialize();
127 return instance;
128}
129
130 template <class T, class A1, class A2, class A3>
131boost::shared_ptr<T> newLucene(A1 const& a1, A2 const& a2, A3 const& a3) {
132 boost::shared_ptr<T> instance(newInstance<T>(a1, a2, a3));
133 instance->initialize();
134 return instance;
135}
136
137 template <class T, class A1, class A2, class A3, class A4>
138boost::shared_ptr<T> newLucene(A1 const& a1, A2 const& a2, A3 const& a3, A4 const& a4) {
139 boost::shared_ptr<T> instance(newInstance<T>(a1, a2, a3, a4));
140 instance->initialize();
141 return instance;
142}
143
144 template <class T, class A1, class A2, class A3, class A4, class A5>
145boost::shared_ptr<T> newLucene(A1 const& a1, A2 const& a2, A3 const& a3, A4 const& a4, A5 const& a5) {
146 boost::shared_ptr<T> instance(newInstance<T>(a1, a2, a3, a4, a5));
147 instance->initialize();
148 return instance;
149}
150
151 template <class T, class A1, class A2, class A3, class A4, class A5, class A6>
152boost::shared_ptr<T> newLucene(A1 const& a1, A2 const& a2, A3 const& a3, A4 const& a4, A5 const& a5, A6 const& a6) {
153 boost::shared_ptr<T> instance(newInstance<T>(a1, a2, a3, a4, a5, a6));
154 instance->initialize();
155 return instance;
156}
157
158 template <class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7>
159boost::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) {
160 boost::shared_ptr<T> instance(newInstance<T>(a1, a2, a3, a4, a5, a6, a7));
161 instance->initialize();
162 return instance;
163}
164
165 template <class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
166boost::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) {
167 boost::shared_ptr<T> instance(newInstance<T>(a1, a2, a3, a4, a5, a6, a7, a8));
168 instance->initialize();
169 return instance;
170}
171
172 template <class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9>
173boost::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) {
174 boost::shared_ptr<T> instance(newInstance<T>(a1, a2, a3, a4, a5, a6, a7, a8, a9));
175 instance->initialize();
176 return instance;
177}
178
179}
180
181#endif
Lucene
Definition AbstractAllTermDocs.h:12
Lucene::newInstance
boost::shared_ptr< T > newInstance()
Definition LuceneFactory.h:16
Lucene::newLucene
boost::shared_ptr< T > newLucene()
Definition LuceneFactory.h:106

clucene.sourceforge.net