Fawkes API  Fawkes Development Version
mongodb_conncreator.h
1 
2 /***************************************************************************
3  * mongodb_conncreator.h - Fawkes MongoDB connection creator
4  *
5  * Created: Mon Dec 06 21:20:16 2010
6  * Copyright 2006-2017 Tim Niemueller [www.niemueller.de]
7  ****************************************************************************/
8 
9 /* This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version. A runtime exception applies to
13  * this software (see LICENSE.GPL_WRE file mentioned below for details).
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Library General Public License for more details.
19  *
20  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
21  */
22 
23 #ifndef _PLUGINS_MONGODB_ASPECT_MONGODB_CONNCREATOR_H_
24 #define _PLUGINS_MONGODB_ASPECT_MONGODB_CONNCREATOR_H_
25 
26 #include <string>
27 
28 // We can't cleanly forward-declare mongocxx::client due to inline namespacing in mongocxx.
29 #include <mongocxx/client.hpp>
30 
31 namespace fawkes {
32 
33 /** @class MongoDBConnCreator <plugins/mongodb/aspect/mongodb_conncreator.h>
34  * Interface for a MongoDB connection creator.
35  * @author Tim Niemueller
36  */
38 {
39 public:
40  /** Create a new MongoDB client.
41  * @param config_name MongoDB client configuration name for the desired
42  * connection. May be empty in which case the default configuration is used.
43  * @return MongoDB client for the given (or the default) configuration.
44  * @exception thrown if the initialization fails or the configuration for
45  * the given name does not exist.
46  */
47  virtual mongocxx::client *create_client(const std::string &config_name = "") = 0;
48 
49  /** Delete a client.
50  * @param client client to delete
51  */
52  virtual void delete_client(mongocxx::client *client) = 0;
53 };
54 
55 } // end namespace fawkes
56 
57 #endif
fawkes::MongoDBConnCreator::create_client
virtual mongocxx::client * create_client(const std::string &config_name="")=0
Create a new MongoDB client.
fawkes::MongoDBConnCreator
Interface for a MongoDB connection creator.
Definition: mongodb_conncreator.h:38
fawkes
Fawkes library namespace.
fawkes::MongoDBConnCreator::delete_client
virtual void delete_client(mongocxx::client *client)=0
Delete a client.