BSON C++ API  2.5.1
uma::bson
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
uma::bson::io::ObjectWriter Class Reference

#include <ObjectWriter.h>

+ Inheritance diagram for uma::bson::io::ObjectWriter:
+ Collaboration diagram for uma::bson::io::ObjectWriter:

Public Member Functions

 ObjectWriter (const uma::bson::Object &obj, std::ostream &os)
 Create a new instance of the writer to serialise the specified object to the output stream.
 
virtual ~ObjectWriter ()
 Virtual destructor for sub-classes.
 
virtual void write ()
 Serialise the object instance to the output stream. Sub-classes may re-implement to customise serialisation of custom model objects.
 
- Public Member Functions inherited from uma::bson::io::Writer
virtual ~Writer ()
 Virtual destructor for sub-classes.
 

Protected Member Functions

const uma::bson::ObjectgetObject () const
 Return the object that is being serialised using this instance.
 
virtual void write (const Object &obj)
 Serialises a BSON object implementation to the output stream. This method is used primarily for serialising sub-classes of uma::bson::Object which implement simple object models. Default uma::bson::Document instances are serialised using the more specialised write( const uma::bson::Document& ) method.
 
void write (const Array &arr)
 Serialises an array to the output stream.
 
- Protected Member Functions inherited from uma::bson::io::Writer
 Writer (std::ostream &os)
 Create a new instance of the writer that will write to the specified output stream.
 
std::ostream & getStream ()
 Return the output stream for use from sub-classes.
 
void write (const int32_t value)
 Writes a 32 bit integer value to the output stream.
 
void write (const int64_t value)
 Writes a 64 bit integer value to the output stream.
 
void write (const double value)
 Writes a double value to the output stream.
 
void write (const bool value)
 Writes a boolean value to the output stream.
 
void write (const std::string &value, const bool withLength=false)
 Writes a std::string value to the output stream.
 
void write (const BinaryData &data)
 Writes binary data type value to the output stream.
 
void write (const ObjectId &oid)
 Writes a MongoDB OID value to the output stream.
 
void write (const Date &date)
 Writes a date-time value to the output stream.
 
void write (const RegularExpression &regex)
 Writes a regular expression value to the output stream.
 
void write (const DatabaseReference &dbref)
 Writes a MongoDB database reference value to the output stream.
 
void write (const CodeWithScope &code)
 Writes a code with scope value to the output stream.
 
void write (const Timestamp &ts)
 Writes a timestamp value to the output stream.
 
void write (const Element &element)
 Serialises a bson element to the output stream.
 
void write (const Document &doc)
 Serialises a document to the output stream.
 

Detailed Description

A base streaming writer class that transforms the data in a bson object into a BSON representation and writes it to an output stream.

Since
Version 2.2
Date
Created 2012/12/18 07:25
Author
Rakesh
Version
Id:
ObjectWriter.h 181 2012-12-21 01:08:58Z spt

Constructor & Destructor Documentation

uma::bson::io::ObjectWriter::ObjectWriter ( const uma::bson::Object obj,
std::ostream &  os 
)

Create a new instance of the writer to serialise the specified object to the output stream.

Parameters
objThe object to serialise
osThe output stream to write to.
virtual uma::bson::io::ObjectWriter::~ObjectWriter ( )
inlinevirtual

Virtual destructor for sub-classes.

Member Function Documentation

const uma::bson::Object& uma::bson::io::ObjectWriter::getObject ( ) const
inlineprotected

Return the object that is being serialised using this instance.

Returns
The object that is being serialised using this writer.
virtual void uma::bson::io::ObjectWriter::write ( )
virtual

Serialise the object instance to the output stream. Sub-classes may re-implement to customise serialisation of custom model objects.

virtual void uma::bson::io::ObjectWriter::write ( const Object obj)
protectedvirtual

Serialises a BSON object implementation to the output stream. This method is used primarily for serialising sub-classes of uma::bson::Object which implement simple object models. Default uma::bson::Document instances are serialised using the more specialised write( const uma::bson::Document& ) method.

Parameters
objThe object to serialise to BSON.
void uma::bson::io::ObjectWriter::write ( const Array arr)
protectedvirtual

Serialises an array to the output stream.

Parameters
valueThe value to serialise to BSON

Reimplemented from uma::bson::io::Writer.


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