knowrob  2.1.0
A Knowledge Base System for Cognition-enabled Robots
knowrob::mongo::Document Class Reference

#include <Document.h>

Public Member Functions

 Document (bson_t *bson)
 
 Document (const Document &)=delete
 
 ~Document ()
 
bson_t * bson () const
 
 Document (bson_t *bson)
 
 Document (const Document &)=delete
 
 ~Document ()
 
bson_t * bson () const
 

Static Public Member Functions

static void print_canonical (bson_t *bson)
 
static void print_relaxed (bson_t *bson)
 
static void print_canonical (bson_t *bson)
 
static void print_relaxed (bson_t *bson)
 

Protected Attributes

bson_t * bson_
 

Detailed Description

A scoped bson document. The memory of the bson_t* is managed by this object, and is freed when the object is destroyed.

Definition at line 16 of file Document.h.

Constructor & Destructor Documentation

◆ Document() [1/4]

knowrob::mongo::Document::Document ( bson_t *  bson)
inlineexplicit

Definition at line 18 of file Document.h.

18 : bson_(bson) {}
bson_t * bson() const
Definition: Document.h:27

◆ Document() [2/4]

knowrob::mongo::Document::Document ( const Document )
delete

◆ ~Document() [1/2]

knowrob::mongo::Document::~Document ( )
inline

Definition at line 22 of file Document.h.

22 { bson_destroy(bson_); }

◆ Document() [3/4]

knowrob::mongo::Document::Document ( bson_t *  bson)
inlineexplicit

Definition at line 18 of file Document.h.

18 : bson_(bson) {}

◆ Document() [4/4]

knowrob::mongo::Document::Document ( const Document )
delete

◆ ~Document() [2/2]

knowrob::mongo::Document::~Document ( )
inline

Definition at line 22 of file Document.h.

22 { bson_destroy(bson_); }

Member Function Documentation

◆ bson() [1/2]

bson_t* knowrob::mongo::Document::bson ( ) const
inline
Returns
the managed bson document

Definition at line 27 of file Document.h.

27 { return bson_; }

◆ bson() [2/2]

bson_t* knowrob::mongo::Document::bson ( ) const
inline
Returns
the managed bson document

Definition at line 27 of file Document.h.

27 { return bson_; }

◆ print_canonical() [1/2]

static void knowrob::mongo::Document::print_canonical ( bson_t *  bson)
inlinestatic

Definition at line 29 of file Document.h.

29  {
30  size_t len;
31  auto str = bson_as_canonical_extended_json(bson, &len);
32  printf("%s\n", str);
33  bson_free(str);
34  }

◆ print_canonical() [2/2]

static void knowrob::mongo::Document::print_canonical ( bson_t *  bson)
inlinestatic

Definition at line 29 of file Document.h.

29  {
30  size_t len;
31  auto str = bson_as_canonical_extended_json(bson, &len);
32  printf("%s\n", str);
33  bson_free(str);
34  }

◆ print_relaxed() [1/2]

static void knowrob::mongo::Document::print_relaxed ( bson_t *  bson)
inlinestatic

Definition at line 36 of file Document.h.

36  {
37  size_t len;
38  auto str = bson_as_relaxed_extended_json(bson, &len);
39  printf("%s\n", str);
40  bson_free(str);
41  }

◆ print_relaxed() [2/2]

static void knowrob::mongo::Document::print_relaxed ( bson_t *  bson)
inlinestatic

Definition at line 36 of file Document.h.

36  {
37  size_t len;
38  auto str = bson_as_relaxed_extended_json(bson, &len);
39  printf("%s\n", str);
40  bson_free(str);
41  }

Member Data Documentation

◆ bson_

bson_t * knowrob::mongo::Document::bson_
protected

Definition at line 44 of file Document.h.


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