Converter from value::Matrix to shared_ptr<std::vector<std::vector<ElementType>>>
.
More...
#include "keyvalue/key/converter/StdMatrix.h"
Public Types | |
typedef value::Matrix | InputType_ |
Compulsory member. | |
typedef shared_ptr < std::vector< std::vector < ElementType > > > | OutputType_ |
Compulsory member. | |
Public Member Functions | |
StdMatrix (const InputType_ &input, OutputType_ *cache) | |
Compulsory constructor. | |
bool | isEmpty () const |
Compulsory member: Checks if conversion has finished. | |
value::Variant | pop () |
Compulsory member: Gets next input element. | |
void | insert (const ElementType &element) |
Compulsory member: Inserts a new element into the output container. | |
OutputType_ | getOutput () const |
Compulsory member: Gets output container. | |
bool | mustUpdate () const |
Compulsory member: Informs if cached value is up to date. | |
Private Attributes | |
const InputType_ & | input_ |
OutputType_ | output_ |
OutputType_ * | cache_ |
size_t | nRows_ |
size_t | nCols_ |
size_t | i_ |
size_t | j_ |
bool | mustUpdate_ |
Converter from value::Matrix to shared_ptr<std::vector<std::vector<ElementType>>>
.
StdSingle together with StdMatrix and StdMatrix might serve as samples for bridge developers who want to implement their own converters. A few constraints have to be verified. Reading documentation for these three class
es before implement any converter is strongly advisable.
ElementType | : The output container's element type. |
InputType_ | : value::Matrix; | |
OutputType_ | : shared_ptr<std::vector<std::vector<Element>>> . |
typedef value::Matrix InputType_ |
Compulsory member.
typedef shared_ptr<std::vector<std::vector<ElementType> > > OutputType_ |
Compulsory member.
Notice that getOutput() returns an OutputType_ object by value. Hence, it is advisable for this type to be cheap-to-copy.
StdMatrix | ( | const InputType_ & | input, | |
OutputType_ * | cache | |||
) | [inline] |
Compulsory constructor.
Internally, the converter must store a copy of the input and a copy of previously cached output (if any). It have also to compare the new computed output with the cached one to see if anything dependent on the cached output must bu updated. (See mustUpdate().)
input | : Input data. | |
cache | : A pointer to the previoulsy cached value if there exist one. Otherwise, a null pointer must be given. |
bool isEmpty | ( | ) | const [inline] |
Compulsory member: Checks if conversion has finished.
true
if all elements of input data have been processed. Otherwise, it must returns false
. value::Variant pop | ( | ) | [inline] |
Compulsory member: Gets next input element.
void insert | ( | const ElementType & | element | ) | [inline] |
Compulsory member: Inserts a new element into the output container.
element | : The element to be inserted into the output container. |
StdMatrix< ElementType >::OutputType_ getOutput | ( | ) | const [inline] |
Compulsory member: Gets output container.
bool mustUpdate | ( | ) | const [inline] |
Compulsory member: Informs if cached value is up to date.
true
if cached value is out of date. Otherwise it returns false
.