AOSharedServiceLibrary
factory_mongo.h
1 /*
2 MIT License Block
3 
4 Copyright (c) 2016 Alex Barry
5 
6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated documentation files (the "Software"), to deal
8 in the Software without restriction, including without limitation the rights
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 copies of the Software, and to permit persons to whom the Software is
11 furnished to do so, subject to the following conditions:
12 
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
15 
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 THE SOFTWARE.
23 */
24 
25 #ifndef AOSSL_MONGO_INCLUDE_FACTORY_MONGO_H_
26 #define AOSSL_MONGO_INCLUDE_FACTORY_MONGO_H_
27 
28 #include <string>
29 #include "mongo_interface.h"
30 #include "mongo_admin.h"
31 #include "mongo_buffer_interface.h"
32 #include "mongo_buffer.h"
33 
35 
41  public:
44 
47 
49  inline AOSSL::MongoBufferInterface* get_mongo_buffer() {return new AOSSL::MongoBuffer;}
50 
52  inline MongoInterface* get_mongo_interface(const char * url, \
53  const char * db, const char * collection_name) {
54  return new MongoClient(url, db, collection_name);
55  }
56 
58  inline MongoInterface* get_mongo_interface(std::string url, \
59  std::string db, std::string collection_name) {
60  return new MongoClient(url, db, collection_name);
61  }
62 
64  inline MongoInterface* get_mongo_interface(const char * url, \
65  const char * db) {
66  return new MongoClient(url, db);
67  }
68 
70  inline MongoInterface* get_mongo_interface(std::string url, std::string db) {
71  return new MongoClient(url, db);
72  }
73 
75  inline MongoInterface* get_mongo_interface(const char * url, \
76  const char * db, const char * collection_name, int pool_size) {
77  return new MongoClient(url, db, collection_name, pool_size);
78  }
79 
81  inline MongoInterface* get_mongo_interface(std::string url, \
82  std::string db, std::string collection_name, int pool_size) {
83  return new MongoClient(url, db, collection_name, pool_size);
84  }
85 
87  inline MongoInterface* get_mongo_interface(const char * url, const char * db,\
88  const char * collection_name, int pool_size, int pstart_size, int pbatch) {
89  return new MongoClient(url, db, collection_name, pool_size, pstart_size, pbatch);
90  }
91 
93  inline MongoInterface* get_mongo_interface(std::string url, std::string db, \
94  std::string collection_name, int pool_size, int pstart_size, int pbatch) {
95  return new MongoClient(url, db, collection_name, pool_size, pstart_size, pbatch);
96  }
97 
99  inline MongoInterface* get_mongo_interface(const char * url, \
100  const char * db, int pool_size) {
101  return new MongoClient(url, db, pool_size);
102  }
103 
105  inline MongoInterface* get_mongo_interface(std::string url, \
106  std::string db, int pool_size) {
107  return new MongoClient(url, db, pool_size);
108  }
109 };
110 
111 #endif // AOSSL_MONGO_INCLUDE_FACTORY_MONGO_H_
MongoInterface * get_mongo_interface(const char *url, const char *db)
Get a Mongo Interface instance.
Definition: factory_mongo.h:64
AOSSL::MongoBufferInterface * get_mongo_buffer()
Get a Mongo Buffer, representing a BSON Document.
Definition: factory_mongo.h:49
MongoInterface * get_mongo_interface(std::string url, std::string db, std::string collection_name)
Get a Mongo Interface instance.
Definition: factory_mongo.h:58
~MongoComponentFactory()
Delete a Service Component Factory.
Definition: factory_mongo.h:46
MongoInterface * get_mongo_interface(std::string url, std::string db)
Get a Mongo Interface instance.
Definition: factory_mongo.h:70
MongoInterface * get_mongo_interface(const char *url, const char *db, const char *collection_name, int pool_size, int pstart_size, int pbatch)
Get a Mongo Interface instance.
Definition: factory_mongo.h:87
A Structure for holding a BSON Document.
Definition: mongo_buffer_interface.h:66
MongoComponentFactory()
Create a new Service Component Factory.
Definition: factory_mongo.h:43
MongoInterface * get_mongo_interface(const char *url, const char *db, int pool_size)
Get a Mongo Interface instance.
Definition: factory_mongo.h:99
MongoInterface * get_mongo_interface(std::string url, std::string db, std::string collection_name, int pool_size, int pstart_size, int pbatch)
Get a Mongo Interface instance.
Definition: factory_mongo.h:93
MongoInterface * get_mongo_interface(std::string url, std::string db, std::string collection_name, int pool_size)
Get a Mongo Interface instance.
Definition: factory_mongo.h:81
MongoInterface * get_mongo_interface(std::string url, std::string db, int pool_size)
Get a Mongo Interface instance.
Definition: factory_mongo.h:105
The Mongo Service Component Factory.
Definition: factory_mongo.h:40
MongoInterface * get_mongo_interface(const char *url, const char *db, const char *collection_name, int pool_size)
Get a Mongo Interface instance.
Definition: factory_mongo.h:75
MongoInterface * get_mongo_interface(const char *url, const char *db, const char *collection_name)
Get a Mongo Interface instance.
Definition: factory_mongo.h:52
Definition: mongo_interface.h:75