Fawkes API  Fawkes Development Version
fawkes::MongoDBAspect Class Reference

#include <>>

Inheritance diagram for fawkes::MongoDBAspect:

Public Member Functions

 MongoDBAspect (const char *config_prefix)
 Constructor. More...
 
 MongoDBAspect ()
 Constructor. More...
 
virtual ~MongoDBAspect ()
 Virtual empty destructor. More...
 
const std::string & mongodb_config_name () const
 
- Public Member Functions inherited from fawkes::Aspect
const std::list< const char * > & get_aspects () const
 Get list of aspect names attached to a aspected thread. More...
 

Protected Attributes

mongocxx::client * mongodb_client
 
MongoDBConnCreatormongodb_connmgr
 

Additional Inherited Members

- Protected Member Functions inherited from fawkes::Aspect
void add_aspect (const char *name)
 Add an aspect to a thread. More...
 

Detailed Description

Thread aspect to access MongoDB. Give this aspect to your thread to gain access to MongoDB. This will setup the mongodb_client member with an active, auto-recovering connection to MongoDB (can be any kind of connection, single server, replicat set, or sync cluster).

Author
Tim Niemueller

Definition at line 41 of file mongodb.h.

Constructor & Destructor Documentation

◆ MongoDBAspect() [1/2]

fawkes::MongoDBAspect::MongoDBAspect ( const char *  config_name)

Constructor.

Parameters
config_nameoptional configuration name from which the configuration for the database is read from the global configuration.

Definition at line 64 of file mongodb.cpp.

◆ MongoDBAspect() [2/2]

fawkes::MongoDBAspect::MongoDBAspect ( )

Constructor.

Using this constructor will leave the mongodb_client member uninitialized. The mongodb_connmgr can be used to create connections at a later point in time.

Definition at line 74 of file mongodb.cpp.

◆ ~MongoDBAspect()

fawkes::MongoDBAspect::~MongoDBAspect ( )
virtual

Virtual empty destructor.

Definition at line 80 of file mongodb.cpp.

Member Function Documentation

◆ mongodb_config_name()

const std::string & fawkes::MongoDBAspect::mongodb_config_name ( ) const
inline

Get MongoDB configuration name.

Returns
MongoDB path name for the configuration settings from the global configuration. Note that this may return 0 if the default configuration should be used.

Definition at line 51 of file mongodb.h.

Member Data Documentation

◆ mongodb_client

mongo::DBClientBase * fawkes::MongoDBAspect::mongodb_client
protected

MongoDB client to use to interact with the database. If database name, user and password were given to constructor, authentication has been executed (and only on success the aspect is considered to be successfully initialized).

Definition at line 57 of file mongodb.h.

Referenced by PointCloudDBRetrieveThread::init(), PointCloudDBMergeThread::init(), MongoLogPointCloudThread::init(), MongoLogImagesThread::init(), MongoRRDThread::loop(), MongoLogPointCloudThread::loop(), and MongoLogBlackboardThread::run().

◆ mongodb_connmgr

fawkes::MongoDBConnCreator * fawkes::MongoDBAspect::mongodb_connmgr
protected

Connection manager to retrieve more client connections from if necessary.

Definition at line 58 of file mongodb.h.

Referenced by MongoLogBlackboardThread::finalize(), MongoLogBlackboardThread::init(), and RobotMemoryThread::init().


The documentation for this class was generated from the following files: