Bufferer Class Reference

Bufferer Class. More...

#include <Bufferer.hpp>

List of all members.

Public Member Functions

 Bufferer (string fpath, ios_base::openmode mode)
 Constructor to initialize a Bufferer stream either for writing or reading.
long writeHeader (const string &str)
 This function will Write a header for objects before writing their data.
void readHeader (const string &str)
 A function to verify and read the header of the object.
void writeSize (long spos)
 writes size of the object.
void write (const string &str)
 Writes null terminated string object.
void read (string &str)
 reads null terminated string object.
void write (string name, const std::vector< string > &value)
 Writes a vector of strings.
void read (string name, std::vector< string > &value)
 reads a vector of strings from current location in file.
void write (string name, const std::vector< std::vector< int > > &value)
 Writes a vector of vector of ints.
void read (string name, std::vector< std::vector< int > > &value)
 reads a vector of vector of ints from current location in file.
void write (string name, int value)
 writes a 4-byte integer object.
void read (string name, int &value)
 reads a 4-byte integer object from current location in file.
void write (string name, const std::vector< int > &value)
 Writes a vector of int.
void read (string name, std::vector< int > &value)
 reads a vector of integers from current location in file.
void write (string name, bool value)
 writes a 1-byte bool object.
void read (string name, bool &value)
 reads a 1-byte bool object from current location in file.
void write (string name, const std::vector< bool > &value)
 Writes a vector of bool.
void read (string name, std::vector< bool > &value)
 reads a vector of bools from current location in file.
void write (string name, unsigned char value)
 writes a 1-byte char object.
void read (string name, unsigned char &value)
 reads a 1-byte char object from current location in file.
void write (string name, double value)
 writes a 8-byte double object.
void read (string name, double &value)
 reads a 8-byte double object from current location in file.
void write (string name, const std::vector< double > &value)
 Writes a vector of double.
void read (string name, std::vector< double > &value)
 reads a vector of double from current location in file.
void write (string name, const std::vector< std::vector< double > > &value)
 Writes a vector of vector of double.
void read (string name, std::vector< std::vector< double > > &value)
 reads a vector of vector of double from current location in file.
void write (string name, const Mat &value)
 writes a openCV Mat object.
void read (string name, Mat &value)
 reads an OpenCv Mat object from current location in file.
void write (string name, const std::vector< Mat > &value)
 Writes a vector of Mat.
void read (string name, std::vector< Mat > &value)
 reads a vector of Mat from current location in file.
void write (const Point3i &p)
 writes a Point3i object with default name "Point3i".
void read (Point3i &p)
 reads a Point3i object from current location in file.
void write (string name, const std::vector< Point3i > &value)
 Writes a vector of Point3i.
void read (string name, std::vector< Point3i > &value)
 reads a vector of Point3i from current location in file.
void write (string name, const std::vector< Point2i > &value)
 Writes a vector of Point2i.
void read (string name, std::vector< Point2i > &value)
 reads a vector of Point2i from current location in file.
void write (const DytexOptions &opt)
 writes a DytexOptions object with default name "DytexOptions".
void read (DytexOptions &opt)
 reads a DytexOptions object from current location in file.
void write (const DytexRegOptions &opt)
 writes a DytexRegOptions object with default name "DytexRegOptions".
void read (DytexRegOptions &opt)
 reads a DytexRegOptions object from current location in file.
void write (const CovMatrix &cm)
 writes a CovMatrix object with default name "CovMatrix".
void read (CovMatrix &cm)
 reads a CovMatrix object from current location in file.
void write (const PatchOptions &popt)
 writes a PatchOptions object with default name "PatchOptions".
void read (PatchOptions &popt)
 reads a PatchOptions object from current location in file.
void write (const PatchExtractor &pe)
 writes a PatchExtractor object with default name "PatchExtractor".
void read (PatchExtractor &pe)
 reads a PatchExtractor object from current location in file.
void write (const Dytex &dt)
 writes a Dytex object with default name "Dytex".
void read (Dytex &dt)
 reads a Dytex object from current location in file.
void write (const DytexMix &dtm)
 writes a DytexMix object with default name "DytexMix".
void read (DytexMix &dtm)
 reads a DytexMix object from current location in file.
void close ()
 closes reading/writing stream and release the file.

Private Attributes

fstream buff
 Bufferer stream.

Detailed Description

Bufferer Class.

This is the class for serialization of various Dynamic Texture related objects and options. Set of functions for saving and loading of Dynamic Textures from binary file are provided. Multiple objects can be stored in a single file sequentially by using a set of overloaded write functions. While writing an object, first a header is written which consist of name (string), version (currently all objects have 1.0) and size in bytes. Followed by this header all memory occupied by object is written. This class also consist of functions for writing primitive types such as int, double, etc, which can be either used separatly or help in writing data for DT objects.

See also:
Dytex | DytexMix.

Definition at line 26 of file Bufferer.hpp.


Constructor & Destructor Documentation

Bufferer::Bufferer ( string  fpath,
ios_base::openmode  mode 
)

Constructor to initialize a Bufferer stream either for writing or reading.

Parameters:
fpath path to the file from where data will be read or written.
mode {fstream::out | fstream::binary} must be used for initializing a writing stream and {fstream::in | fstream::binary} must be used for openening a file for reading.

Only way to initialize or open a bufferer object. Data file and mode must be speciied. specified file will be linked with the bufferer object for reading or writing purpose

See also:
Bufferer::close()

Definition at line 41 of file Bufferer.cpp.


Member Function Documentation

void Bufferer::close (  ) 

closes reading/writing stream and release the file.

See also:
Bufferer::Bufferer(string fpath,ios_base::openmode mode)

Definition at line 1547 of file Bufferer.cpp.

void Bufferer::read ( DytexMix &  dtm  ) 

reads a DytexMix object from current location in file.

Parameters:
dtm where to copy read DytexMix.
See also:
Bufferer::write(const DytexMix &dtm) | Bufferer::read(Dytex &dt)

Definition at line 1513 of file Bufferer.cpp.

Here is the call graph for this function:

void Bufferer::read ( Dytex &  dt  ) 

reads a Dytex object from current location in file.

Parameters:
dt where to copy read Dytex.
See also:
Bufferer::write(const Dytex &dt) | Bufferer::read(DytexMix &dtm)

Definition at line 1455 of file Bufferer.cpp.

Here is the call graph for this function:

void Bufferer::read ( PatchExtractor &  pe  ) 

reads a PatchExtractor object from current location in file.

Parameters:
pe where to copy read PatchExtractor.
See also:
Bufferer::write(const PatchExtractor &pe)

Definition at line 1363 of file Bufferer.cpp.

Here is the call graph for this function:

void Bufferer::read ( PatchOptions &  popt  ) 

reads a PatchOptions object from current location in file.

Parameters:
popt where to copy read PatchOptions.
See also:
Bufferer::write(const PatchOptions &popt)

Definition at line 1309 of file Bufferer.cpp.

Here is the call graph for this function:

void Bufferer::read ( CovMatrix &  cm  ) 

reads a CovMatrix object from current location in file.

Parameters:
cm where to copy read CovMatrix.
See also:
Bufferer::write(const CovMatrix &cm)

Definition at line 1264 of file Bufferer.cpp.

Here is the call graph for this function:

void Bufferer::read ( DytexRegOptions &  opt  ) 

reads a DytexRegOptions object from current location in file.

Parameters:
opt where to copy read DytexRegOptions.
See also:
Bufferer::write(const DytexRegOptions &opt)

Definition at line 1213 of file Bufferer.cpp.

Here is the call graph for this function:

void Bufferer::read ( DytexOptions &  opt  ) 

reads a DytexOptions object from current location in file.

Parameters:
opt where to copy read DytexOptions.
See also:
Bufferer::write(const DytexOptions &opt)

Definition at line 1164 of file Bufferer.cpp.

Here is the call graph for this function:

void Bufferer::read ( string  name,
std::vector< Point2i > &  vec 
)

reads a vector of Point2i from current location in file.

Parameters:
name name of the Point2i vector object to read.
vec where to store the list of Point2i.
See also:
Bufferer::write(string name,const std::vector<Point2i> &vec)

Definition at line 1115 of file Bufferer.cpp.

Here is the call graph for this function:

void Bufferer::read ( string  name,
std::vector< Point3i > &  vec 
)

reads a vector of Point3i from current location in file.

Parameters:
name name of the Point3i vector object to read.
vec where to store the list of Point3i.
See also:
Bufferer::write(string name,const std::vector<Point3i> &vec)

Definition at line 1051 of file Bufferer.cpp.

Here is the call graph for this function:

void Bufferer::read ( Point3i &  p  ) 

reads a Point3i object from current location in file.

Parameters:
p where to copy read Point3i.
See also:
Bufferer::write(const Point3i &p)

Definition at line 999 of file Bufferer.cpp.

Here is the call graph for this function:

void Bufferer::read ( string  name,
std::vector< Mat > &  vec 
)

reads a vector of Mat from current location in file.

Parameters:
name name of the Mat vector object to read.
vec where to store the list of Mats.
See also:
Bufferer::write(string name,const std::vector<Mat> &vec)

Definition at line 955 of file Bufferer.cpp.

Here is the call graph for this function:

void Bufferer::read ( string  name,
Mat &  mtx 
)

reads an OpenCv Mat object from current location in file.

Parameters:
name name of the object.
mtx where to copy read Mat.
See also:
Bufferer::write(string name,const Mat &mtx)

Definition at line 812 of file Bufferer.cpp.

Here is the call graph for this function:

void Bufferer::read ( string  name,
std::vector< std::vector< double > > &  vec 
)

reads a vector of vector of double from current location in file.

Parameters:
name name of the int vector object to read.
vec where to store the list of double.
See also:
Bufferer::write(string name,const std::vector<string> &vec)

Definition at line 638 of file Bufferer.cpp.

Here is the call graph for this function:

void Bufferer::read ( string  name,
std::vector< double > &  vec 
)

reads a vector of double from current location in file.

Parameters:
name name of the double vector object to read.
vec where to store the list of doubls.
See also:
Bufferer::write(string name,const std::vector<string> &vec)

Definition at line 580 of file Bufferer.cpp.

Here is the call graph for this function:

void Bufferer::read ( string  name,
double &  val 
)

reads a 8-byte double object from current location in file.

Parameters:
name name of the object.
val where to copy read double.
See also:
Bufferer::write(string name,double val)

Definition at line 668 of file Bufferer.cpp.

Here is the call graph for this function:

void Bufferer::read ( string  name,
unsigned char &  val 
)

reads a 1-byte char object from current location in file.

Parameters:
name name of the object.
val where to copy read char.
See also:
Bufferer::write(string name,unsigned char val)

Definition at line 511 of file Bufferer.cpp.

Here is the call graph for this function:

void Bufferer::read ( string  name,
std::vector< bool > &  vec 
)

reads a vector of bools from current location in file.

Parameters:
name name of the bool vector object to read.
vec where to store the list of bools.
See also:
Bufferer::write(string name,const std::vector<bool> &vec)

Definition at line 464 of file Bufferer.cpp.

Here is the call graph for this function:

void Bufferer::read ( string  name,
bool &  val 
)

reads a 1-byte bool object from current location in file.

Parameters:
name name of the object.
val where to copy read bool.
See also:
Bufferer::write(string name,bool val)

Definition at line 416 of file Bufferer.cpp.

Here is the call graph for this function:

void Bufferer::read ( string  name,
std::vector< int > &  vec 
)

reads a vector of integers from current location in file.

Parameters:
name name of the int vector object to read.
vec where to store the list of ints.
See also:
Bufferer::write(string name,const std::vector<string> &vec)

Definition at line 368 of file Bufferer.cpp.

Here is the call graph for this function:

void Bufferer::read ( string  name,
int &  val 
)

reads a 4-byte integer object from current location in file.

Parameters:
name name of the object.
val where to copy read integer.
See also:
Bufferer::write(string name,int val)

Definition at line 319 of file Bufferer.cpp.

Here is the call graph for this function:

void Bufferer::read ( string  name,
std::vector< std::vector< int > > &  vec 
)

reads a vector of vector of ints from current location in file.

Parameters:
name name of the int vector object to read.
vec where to store the list of int.
See also:
Bufferer::write(string name,const std::vector<string> &vec)

Definition at line 270 of file Bufferer.cpp.

Here is the call graph for this function:

void Bufferer::read ( string  name,
std::vector< string > &  vec 
)

reads a vector of strings from current location in file.

Parameters:
name name of the string vector object to read.
vec where to store the list of strings.
See also:
Bufferer::write(string name,const std::vector<string> &vec)

Definition at line 212 of file Bufferer.cpp.

Here is the call graph for this function:

void Bufferer::read ( string &  str  ) 

reads null terminated string object.

Parameters:
str where to copy read string data.
See also:
Bufferer::write(string &str)

Definition at line 160 of file Bufferer.cpp.

Here is the caller graph for this function:

void Bufferer::readHeader ( const string &  str  ) 

A function to verify and read the header of the object.

Parameters:
str name of the object to be read.
Exceptions:
if object name or version mismatch then it will throw CV_Error.

This function will read name, version and size of the object and compares with the specified name. At the end file pointer will be at the begining of the data for the object

See also:
Bufferer::writeHeader(const string &str)

Definition at line 87 of file Bufferer.cpp.

Here is the caller graph for this function:

void Bufferer::write ( const DytexMix &  dtm  ) 

writes a DytexMix object with default name "DytexMix".

Parameters:
dtm value of DytexMix.
See also:
Bufferer::read(DytexMix &dtm) | Bufferer::write(const Dytex &dt)

Definition at line 1480 of file Bufferer.cpp.

Here is the call graph for this function:

void Bufferer::write ( const Dytex &  dt  ) 

writes a Dytex object with default name "Dytex".

Parameters:
dt value of Dytex.
See also:
Bufferer::read(Dytex &dt) | Bufferer::write(const DytexMix &dtm)

Definition at line 1429 of file Bufferer.cpp.

Here is the call graph for this function:

void Bufferer::write ( const PatchExtractor &  pe  ) 

writes a PatchExtractor object with default name "PatchExtractor".

Parameters:
pe value of PatchExtractor.
See also:
Bufferer::read(PatchExtractor &pe)

Definition at line 1330 of file Bufferer.cpp.

Here is the call graph for this function:

void Bufferer::write ( const PatchOptions &  popt  ) 

writes a PatchOptions object with default name "PatchOptions".

Parameters:
popt value of PatchOptions.
See also:
Bufferer::read(PatchOptions &popt)

Definition at line 1289 of file Bufferer.cpp.

Here is the call graph for this function:

void Bufferer::write ( const CovMatrix &  cm  ) 

writes a CovMatrix object with default name "CovMatrix".

Parameters:
cm value of CovMatrix.
See also:
Bufferer::read(CovMatrix &cm)

Definition at line 1241 of file Bufferer.cpp.

Here is the call graph for this function:

void Bufferer::write ( const DytexRegOptions &  opt  ) 

writes a DytexRegOptions object with default name "DytexRegOptions".

Parameters:
opt value of DytexRegOptions.
See also:
Bufferer::read(DytexRegOptions &opt)

Definition at line 1188 of file Bufferer.cpp.

Here is the call graph for this function:

void Bufferer::write ( const DytexOptions &  opt  ) 

writes a DytexOptions object with default name "DytexOptions".

Parameters:
opt value of DytexOptions.
See also:
Bufferer::read(DytexOptions &opt) | Bufferer::write(const DytexRegOptions &opt)

Definition at line 1143 of file Bufferer.cpp.

Here is the call graph for this function:

void Bufferer::write ( string  name,
const std::vector< Point2i > &  vec 
)

Writes a vector of Point2i.

Parameters:
name name of the Point2i vector object.
vec list of Point2i objects.
See also:
Bufferer::read(string name,std::vector<Point2i> &vec)

Definition at line 1085 of file Bufferer.cpp.

Here is the call graph for this function:

void Bufferer::write ( string  name,
const std::vector< Point3i > &  vec 
)

Writes a vector of Point3i.

Parameters:
name name of the Point3i vector object.
vec list of Point3i objects.
See also:
Bufferer::read(string name,std::vector<Point3i> &vec)

Definition at line 1020 of file Bufferer.cpp.

Here is the call graph for this function:

void Bufferer::write ( const Point3i &  p  ) 

writes a Point3i object with default name "Point3i".

Parameters:
p value of Point3i.
See also:
Bufferer::read(Point3i &p)

Definition at line 980 of file Bufferer.cpp.

Here is the call graph for this function:

void Bufferer::write ( string  name,
const std::vector< Mat > &  vec 
)

Writes a vector of Mat.

Parameters:
name name of the Mat vector object.
vec list of Mat objects.
See also:
Bufferer::read(string name,std::vector<Mat> &vec)

Definition at line 926 of file Bufferer.cpp.

Here is the call graph for this function:

void Bufferer::write ( string  name,
const Mat &  mtx 
)

writes a openCV Mat object.

Parameters:
name name of the object.

2 & 3 dimensional mat with CV_64F, CV_8U and CV_64FC3 types are supported

Parameters:
mtx mat object to write.
See also:
Bufferer::read(string name,Mat &mtx)

Definition at line 689 of file Bufferer.cpp.

Here is the call graph for this function:

void Bufferer::write ( string  name,
const std::vector< std::vector< double > > &  vec 
)

Writes a vector of vector of double.

Parameters:
name name of the string vector object.
vec vector of list of double.
See also:
Bufferer::read(string name,std::vector<string> &vec)

Definition at line 609 of file Bufferer.cpp.

Here is the call graph for this function:

void Bufferer::write ( string  name,
const std::vector< double > &  vec 
)

Writes a vector of double.

Parameters:
name name of the double vector object.
vec list of doubls.
See also:
Bufferer::read(string name,std::vector<double> &vec)

Definition at line 551 of file Bufferer.cpp.

Here is the call graph for this function:

void Bufferer::write ( string  name,
double  val 
)

writes a 8-byte double object.

Parameters:
name name of the object.
val value of double.
See also:
Bufferer::read(string name,double &val)

Definition at line 530 of file Bufferer.cpp.

Here is the call graph for this function:

void Bufferer::write ( string  name,
unsigned char  val 
)

writes a 1-byte char object.

Parameters:
name name of the object.
val value of char.
See also:
Bufferer::read(string name,unsigned char &val)

Definition at line 491 of file Bufferer.cpp.

Here is the call graph for this function:

void Bufferer::write ( string  name,
const std::vector< bool > &  vec 
)

Writes a vector of bool.

Parameters:
name name of the bool vector object.
vec list of bools.
See also:
Bufferer::read(string name,std::vector<bool> &vec)

Definition at line 435 of file Bufferer.cpp.

Here is the call graph for this function:

void Bufferer::write ( string  name,
bool  val 
)

writes a 1-byte bool object.

Parameters:
name name of the object.
val value of bool.
See also:
Bufferer::read(string name,bool &val)

Definition at line 396 of file Bufferer.cpp.

Here is the call graph for this function:

void Bufferer::write ( string  name,
const std::vector< int > &  vec 
)

Writes a vector of int.

Parameters:
name name of the int vector object.
vec list of ints.
See also:
Bufferer::read(string name,std::vector<int> &vec)

Definition at line 339 of file Bufferer.cpp.

Here is the call graph for this function:

void Bufferer::write ( string  name,
int  val 
)

writes a 4-byte integer object.

Parameters:
name name of the object.
val value of integer.
See also:
Bufferer::read(string name,int &val)

Definition at line 299 of file Bufferer.cpp.

Here is the call graph for this function:

void Bufferer::write ( string  name,
const std::vector< std::vector< int > > &  vec 
)

Writes a vector of vector of ints.

Parameters:
name name of the string vector object.
vec vector of list of ints.
See also:
Bufferer::read(string name,std::vector<string> &vec)

Definition at line 241 of file Bufferer.cpp.

Here is the call graph for this function:

void Bufferer::write ( string  name,
const std::vector< string > &  vec 
)

Writes a vector of strings.

Parameters:
name name of the string vector object.
vec list of strings.
See also:
Bufferer::read(string name,std::vector<string> &vec)

Definition at line 183 of file Bufferer.cpp.

Here is the call graph for this function:

void Bufferer::write ( const string &  str  ) 

Writes null terminated string object.

Parameters:
str string to be written.
See also:
Bufferer::read(string &str)

Definition at line 145 of file Bufferer.cpp.

Here is the caller graph for this function:

long Bufferer::writeHeader ( const string &  str  ) 

This function will Write a header for objects before writing their data.

Parameters:
str name of the object to follow.
Returns:
location in the file where to write the size of the object after counting its bytes at the end of writing process.

header consist of name of the object (a string), verion of the object (a string) and size of the objects (in bytes)

See also:
Bufferer::readHeader(const string &str)

Definition at line 61 of file Bufferer.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void Bufferer::writeSize ( long  spos  ) 

writes size of the object.

Parameters:
spos location in file where to write the size.

This function calculates and writes the size if the object from current location of file pointer and spos.

See also:
Bufferer::writeHeader(const string &str)

Definition at line 125 of file Bufferer.cpp.

Here is the caller graph for this function:


Member Data Documentation

fstream Bufferer::buff [private]

Bufferer stream.

file stream object where bufferer will write set of objects sequentially.

See also:
Separate items with the '|' character.

Definition at line 41 of file Bufferer.hpp.


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

Generated on 18 Dec 2014 for libdt-OpenCV by  doxygen 1.6.1