Skip to content

Commit

Permalink
Add Mongo Buffer Interface method to Mongo Component Factory
Browse files Browse the repository at this point in the history
  • Loading branch information
AO-StreetArt committed Mar 11, 2018
1 parent d79b940 commit f666f5d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions aossl/mongo/include/factory_mongo.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ THE SOFTWARE.
#include <string>
#include "mongo_interface.h"
#include "mongo_admin.h"
#include "mongo_buffer_interface.h"
#include "mongo_buffer.h"

//! The Mongo Service Component Factory

Expand All @@ -43,6 +45,9 @@ class MongoComponentFactory {
//! Delete a Service Component Factory
~MongoComponentFactory() {}

//! Get a Mongo Buffer, representing a BSON Document
inline AOSSL::MongoBufferInterface* get_mongo_buffer() {return new AOSSL::MongoBuffer;}

//! Get a Mongo Interface instance
inline MongoInterface* get_mongo_interface(const char * url, \
const char * db, const char * collection_name) {
Expand Down
2 changes: 1 addition & 1 deletion aossl/mongo/include/mongo_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class MongoBuffer: public Buffer, public MongoBufferInterface {
//! Build a new Mongo Buffer
MongoBuffer() {bson_t *b = new bson_t; bson_init (b); children.push_back(b);}
//! Destroy the Mongo Buffer
~MongoBuffer() {bson_destroy(children[0]); delete children[0]; for (int i = 1; i < children.size(); i++) {delete children[i];}}
~MongoBuffer() {bson_destroy(children[0]); delete children[0]; for (unsigned int i = 1; i < children.size(); i++) {delete children[i];}}
//! Is a successful response
bool successful() {return Buffer::success;}
//! Error message
Expand Down

0 comments on commit f666f5d

Please sign in to comment.