#include <Bufferer.hpp>
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. | |
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.
Definition at line 26 of file Bufferer.hpp.
| Bufferer::Bufferer | ( | string | fpath, | |
| ios_base::openmode | mode | |||
| ) |
Constructor to initialize a Bufferer stream either for writing or reading.
| 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
Definition at line 41 of file Bufferer.cpp.
| void Bufferer::close | ( | ) |
closes reading/writing stream and release the file.
Definition at line 1547 of file Bufferer.cpp.
| void Bufferer::read | ( | DytexMix & | dtm | ) |
reads a DytexMix object from current location in file.
| dtm | where to copy read DytexMix. |
Definition at line 1513 of file Bufferer.cpp.
| void Bufferer::read | ( | Dytex & | dt | ) |
reads a Dytex object from current location in file.
| dt | where to copy read Dytex. |
Definition at line 1455 of file Bufferer.cpp.
| void Bufferer::read | ( | PatchExtractor & | pe | ) |
reads a PatchExtractor object from current location in file.
| pe | where to copy read PatchExtractor. |
Definition at line 1363 of file Bufferer.cpp.
| void Bufferer::read | ( | PatchOptions & | popt | ) |
reads a PatchOptions object from current location in file.
| popt | where to copy read PatchOptions. |
Definition at line 1309 of file Bufferer.cpp.
| void Bufferer::read | ( | CovMatrix & | cm | ) |
reads a CovMatrix object from current location in file.
| cm | where to copy read CovMatrix. |
Definition at line 1264 of file Bufferer.cpp.
| void Bufferer::read | ( | DytexRegOptions & | opt | ) |
reads a DytexRegOptions object from current location in file.
| opt | where to copy read DytexRegOptions. |
Definition at line 1213 of file Bufferer.cpp.
| void Bufferer::read | ( | DytexOptions & | opt | ) |
reads a DytexOptions object from current location in file.
| opt | where to copy read DytexOptions. |
Definition at line 1164 of file Bufferer.cpp.
| void Bufferer::read | ( | string | name, | |
| std::vector< Point2i > & | vec | |||
| ) |
reads a vector of Point2i from current location in file.
| name | name of the Point2i vector object to read. | |
| vec | where to store the list of Point2i. |
Definition at line 1115 of file Bufferer.cpp.
| void Bufferer::read | ( | string | name, | |
| std::vector< Point3i > & | vec | |||
| ) |
reads a vector of Point3i from current location in file.
| name | name of the Point3i vector object to read. | |
| vec | where to store the list of Point3i. |
Definition at line 1051 of file Bufferer.cpp.
| void Bufferer::read | ( | Point3i & | p | ) |
reads a Point3i object from current location in file.
| p | where to copy read Point3i. |
Definition at line 999 of file Bufferer.cpp.
| void Bufferer::read | ( | string | name, | |
| std::vector< Mat > & | vec | |||
| ) |
reads a vector of Mat from current location in file.
| name | name of the Mat vector object to read. | |
| vec | where to store the list of Mats. |
Definition at line 955 of file Bufferer.cpp.
| void Bufferer::read | ( | string | name, | |
| Mat & | mtx | |||
| ) |
reads an OpenCv Mat object from current location in file.
| name | name of the object. | |
| mtx | where to copy read Mat. |
Definition at line 812 of file Bufferer.cpp.
| void Bufferer::read | ( | string | name, | |
| std::vector< std::vector< double > > & | vec | |||
| ) |
reads a vector of vector of double from current location in file.
| name | name of the int vector object to read. | |
| vec | where to store the list of double. |
Definition at line 638 of file Bufferer.cpp.
| void Bufferer::read | ( | string | name, | |
| std::vector< double > & | vec | |||
| ) |
reads a vector of double from current location in file.
| name | name of the double vector object to read. | |
| vec | where to store the list of doubls. |
Definition at line 580 of file Bufferer.cpp.
| void Bufferer::read | ( | string | name, | |
| double & | val | |||
| ) |
reads a 8-byte double object from current location in file.
| name | name of the object. | |
| val | where to copy read double. |
Definition at line 668 of file Bufferer.cpp.
| void Bufferer::read | ( | string | name, | |
| unsigned char & | val | |||
| ) |
reads a 1-byte char object from current location in file.
| name | name of the object. | |
| val | where to copy read char. |
Definition at line 511 of file Bufferer.cpp.
| void Bufferer::read | ( | string | name, | |
| std::vector< bool > & | vec | |||
| ) |
reads a vector of bools from current location in file.
| name | name of the bool vector object to read. | |
| vec | where to store the list of bools. |
Definition at line 464 of file Bufferer.cpp.
| void Bufferer::read | ( | string | name, | |
| bool & | val | |||
| ) |
reads a 1-byte bool object from current location in file.
| name | name of the object. | |
| val | where to copy read bool. |
Definition at line 416 of file Bufferer.cpp.
| void Bufferer::read | ( | string | name, | |
| std::vector< int > & | vec | |||
| ) |
reads a vector of integers from current location in file.
| name | name of the int vector object to read. | |
| vec | where to store the list of ints. |
Definition at line 368 of file Bufferer.cpp.
| void Bufferer::read | ( | string | name, | |
| int & | val | |||
| ) |
reads a 4-byte integer object from current location in file.
| name | name of the object. | |
| val | where to copy read integer. |
Definition at line 319 of file Bufferer.cpp.
| void Bufferer::read | ( | string | name, | |
| std::vector< std::vector< int > > & | vec | |||
| ) |
reads a vector of vector of ints from current location in file.
| name | name of the int vector object to read. | |
| vec | where to store the list of int. |
Definition at line 270 of file Bufferer.cpp.
| void Bufferer::read | ( | string | name, | |
| std::vector< string > & | vec | |||
| ) |
reads a vector of strings from current location in file.
| name | name of the string vector object to read. | |
| vec | where to store the list of strings. |
Definition at line 212 of file Bufferer.cpp.
| void Bufferer::read | ( | string & | str | ) |
reads null terminated string object.
| str | where to copy read string data. |
Definition at line 160 of file Bufferer.cpp.
| void Bufferer::readHeader | ( | const string & | str | ) |
A function to verify and read the header of the object.
| str | name of the object to be read. |
| 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
Definition at line 87 of file Bufferer.cpp.
| void Bufferer::write | ( | const DytexMix & | dtm | ) |
writes a DytexMix object with default name "DytexMix".
| dtm | value of DytexMix. |
Definition at line 1480 of file Bufferer.cpp.
| void Bufferer::write | ( | const Dytex & | dt | ) |
writes a Dytex object with default name "Dytex".
| dt | value of Dytex. |
Definition at line 1429 of file Bufferer.cpp.
| void Bufferer::write | ( | const PatchExtractor & | pe | ) |
writes a PatchExtractor object with default name "PatchExtractor".
| pe | value of PatchExtractor. |
Definition at line 1330 of file Bufferer.cpp.
| void Bufferer::write | ( | const PatchOptions & | popt | ) |
writes a PatchOptions object with default name "PatchOptions".
| popt | value of PatchOptions. |
Definition at line 1289 of file Bufferer.cpp.
| void Bufferer::write | ( | const CovMatrix & | cm | ) |
writes a CovMatrix object with default name "CovMatrix".
| cm | value of CovMatrix. |
Definition at line 1241 of file Bufferer.cpp.
| void Bufferer::write | ( | const DytexRegOptions & | opt | ) |
writes a DytexRegOptions object with default name "DytexRegOptions".
| opt | value of DytexRegOptions. |
Definition at line 1188 of file Bufferer.cpp.
| void Bufferer::write | ( | const DytexOptions & | opt | ) |
writes a DytexOptions object with default name "DytexOptions".
| opt | value of DytexOptions. |
Definition at line 1143 of file Bufferer.cpp.
| void Bufferer::write | ( | string | name, | |
| const std::vector< Point2i > & | vec | |||
| ) |
Writes a vector of Point2i.
| name | name of the Point2i vector object. | |
| vec | list of Point2i objects. |
Definition at line 1085 of file Bufferer.cpp.
| void Bufferer::write | ( | string | name, | |
| const std::vector< Point3i > & | vec | |||
| ) |
Writes a vector of Point3i.
| name | name of the Point3i vector object. | |
| vec | list of Point3i objects. |
Definition at line 1020 of file Bufferer.cpp.
| void Bufferer::write | ( | const Point3i & | p | ) |
writes a Point3i object with default name "Point3i".
| p | value of Point3i. |
Definition at line 980 of file Bufferer.cpp.
| void Bufferer::write | ( | string | name, | |
| const std::vector< Mat > & | vec | |||
| ) |
Writes a vector of Mat.
| name | name of the Mat vector object. | |
| vec | list of Mat objects. |
Definition at line 926 of file Bufferer.cpp.
| void Bufferer::write | ( | string | name, | |
| const Mat & | mtx | |||
| ) |
writes a openCV Mat object.
| name | name of the object. |
2 & 3 dimensional mat with CV_64F, CV_8U and CV_64FC3 types are supported
| mtx | mat object to write. |
Definition at line 689 of file Bufferer.cpp.
| void Bufferer::write | ( | string | name, | |
| const std::vector< std::vector< double > > & | vec | |||
| ) |
Writes a vector of vector of double.
| name | name of the string vector object. | |
| vec | vector of list of double. |
Definition at line 609 of file Bufferer.cpp.
| void Bufferer::write | ( | string | name, | |
| const std::vector< double > & | vec | |||
| ) |
Writes a vector of double.
| name | name of the double vector object. | |
| vec | list of doubls. |
Definition at line 551 of file Bufferer.cpp.
| void Bufferer::write | ( | string | name, | |
| double | val | |||
| ) |
writes a 8-byte double object.
| name | name of the object. | |
| val | value of double. |
Definition at line 530 of file Bufferer.cpp.
| void Bufferer::write | ( | string | name, | |
| unsigned char | val | |||
| ) |
writes a 1-byte char object.
| name | name of the object. | |
| val | value of char. |
Definition at line 491 of file Bufferer.cpp.
| void Bufferer::write | ( | string | name, | |
| const std::vector< bool > & | vec | |||
| ) |
Writes a vector of bool.
| name | name of the bool vector object. | |
| vec | list of bools. |
Definition at line 435 of file Bufferer.cpp.
| void Bufferer::write | ( | string | name, | |
| bool | val | |||
| ) |
writes a 1-byte bool object.
| name | name of the object. | |
| val | value of bool. |
Definition at line 396 of file Bufferer.cpp.
| void Bufferer::write | ( | string | name, | |
| const std::vector< int > & | vec | |||
| ) |
Writes a vector of int.
| name | name of the int vector object. | |
| vec | list of ints. |
Definition at line 339 of file Bufferer.cpp.
| void Bufferer::write | ( | string | name, | |
| int | val | |||
| ) |
writes a 4-byte integer object.
| name | name of the object. | |
| val | value of integer. |
Definition at line 299 of file Bufferer.cpp.
| void Bufferer::write | ( | string | name, | |
| const std::vector< std::vector< int > > & | vec | |||
| ) |
Writes a vector of vector of ints.
| name | name of the string vector object. | |
| vec | vector of list of ints. |
Definition at line 241 of file Bufferer.cpp.
| void Bufferer::write | ( | string | name, | |
| const std::vector< string > & | vec | |||
| ) |
Writes a vector of strings.
| name | name of the string vector object. | |
| vec | list of strings. |
Definition at line 183 of file Bufferer.cpp.
| void Bufferer::write | ( | const string & | str | ) |
Writes null terminated string object.
| str | string to be written. |
Definition at line 145 of file Bufferer.cpp.
| long Bufferer::writeHeader | ( | const string & | str | ) |
This function will Write a header for objects before writing their data.
| str | name of the object to follow. |
header consist of name of the object (a string), verion of the object (a string) and size of the objects (in bytes)
Definition at line 61 of file Bufferer.cpp.
| void Bufferer::writeSize | ( | long | spos | ) |
writes size of the object.
| 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.
Definition at line 125 of file Bufferer.cpp.
fstream Bufferer::buff [private] |
Bufferer stream.
file stream object where bufferer will write set of objects sequentially.
Definition at line 41 of file Bufferer.hpp.
1.6.1