Fawkes API Fawkes Development Version
mongodb.h
1
2/***************************************************************************
3 * mongodb.h - MongoDB aspect for Fawkes
4 *
5 * Created: Mon Dec 06 00:24:43 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_H_
24#define _PLUGINS_MONGODB_ASPECT_MONGODB_H_
25
26#include <aspect/aspect.h>
27
28#include <string>
29
30// We can't cleanly forward-declare mongocxx::client due to inline namespacing in mongocxx.
31#include <mongocxx/client.hpp>
32
33namespace fawkes {
34class MongoDBConnCreator;
35
36class MongoDBAspectIniFin;
37
38class MongoDBAspect : public virtual Aspect
39{
41
42public:
43 MongoDBAspect(const char *config_prefix);
45 virtual ~MongoDBAspect();
46
47 const std::string &
49 {
50 return mongodb_config_name_;
51 }
52
53protected:
54 mongocxx::client * mongodb_client;
56
57private:
58 void init_MongoDBAspect(mongocxx::client *mongodb_client, MongoDBConnCreator *mongodb_connmgr);
59
60private:
61 std::string mongodb_config_name_;
62};
63
64} // end namespace fawkes
65
66#endif
Fawkes aspect base class.
Definition: aspect.h:32
MongoDBAspect initializer/finalizer.
Thread aspect to access MongoDB.
Definition: mongodb.h:39
mongocxx::client * mongodb_client
MongoDB client to use to interact with the database.
Definition: mongodb.h:54
MongoDBConnCreator * mongodb_connmgr
Connection manager to retrieve more client connections from if necessary.
Definition: mongodb.h:55
virtual ~MongoDBAspect()
Virtual empty destructor.
Definition: mongodb.cpp:77
const std::string & mongodb_config_name() const
Get MongoDB configuration name.
Definition: mongodb.h:48
MongoDBAspect()
Constructor.
Definition: mongodb.cpp:71
Interface for a MongoDB connection creator.
Fawkes library namespace.