StdMatrix< ElementType > Class Template Reference

Converter from value::Matrix to shared_ptr<std::vector<std::vector<ElementType>>>. More...

#include "keyvalue/key/converter/StdMatrix.h"

List of all members.

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_

Detailed Description

template<typename ElementType>
class keyvalue::key::StdMatrix< ElementType >

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 classes before implement any converter is strongly advisable.

Parameters:
ElementType : The output container's element type.
Return values:
InputType_ : value::Matrix;
OutputType_ : shared_ptr<std::vector<std::vector<Element>>>.

Member Typedef Documentation

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.


Constructor & Destructor Documentation

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().)

Parameters:
input : Input data.
cache : A pointer to the previoulsy cached value if there exist one. Otherwise, a null pointer must be given.

Member Function Documentation

bool isEmpty (  )  const [inline]

Compulsory member: Checks if conversion has finished.

Returns:
This methods must return 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.

Returns:
A copy of next input element to be processed.
void insert ( const ElementType &  element  )  [inline]

Compulsory member: Inserts a new element into the output container.

Parameters:
element : The element to be inserted into the output container.
StdMatrix< ElementType >::OutputType_ getOutput (  )  const [inline]

Compulsory member: Gets output container.

Returns:
A copy of output container.
bool mustUpdate (  )  const [inline]

Compulsory member: Informs if cached value is up to date.

Returns:
This method returns true if cached value is out of date. Otherwise it returns false.

Generated on Sat Mar 20 15:08:30 2010 for KeyValue by  doxygen 1.6.1