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 namespace mongo {
29 class DBClientBase;
30 }
31 
32 namespace fawkes {
33 
34 /** @class MongoDBConnCreator <plugins/mongodb/aspect/mongodb_conncreator.h>
35  * Interface for a MongoDB connection creator.
36  * @author Tim Niemueller
37  */
39 {
40 public:
41  /** Create a new MongoDB client.
42  * @param config_name MongoDB client configuration name for the desired
43  * connection. May be empty in which case the default configuration is used.
44  * @return MongoDB client for the given (or the default) configuration.
45  * @exception thrown if the initialization fails or the configuration for
46  * the given name does not exist.
47  */
48  virtual mongo::DBClientBase *create_client(const std::string &config_name = "") = 0;
49 
50  /** Delete a client.
51  * @param client client to delete
52  */
53  virtual void delete_client(mongo::DBClientBase *client) = 0;
54 };
55 
56 } // end namespace fawkes
57 
58 #endif
Fawkes library namespace.
virtual mongo::DBClientBase * create_client(const std::string &config_name="")=0
Create a new MongoDB client.
Interface for a MongoDB connection creator.
virtual void delete_client(mongo::DBClientBase *client)=0
Delete a client.