Public Member Functions | Private Member Functions

BuilderFrom< ObjectType, InputType > Class Template Reference

A (possible) base template class of Builder<ObjectType>. More...

#include <keyvalue/mngt/BuilderFrom.h>

List of all members.

Public Member Functions

value::PtrTraits< ObjectType >
::Type_ 
getObject (const value::Variant &data) const

Private Member Functions

virtual value::PtrTraits
< ObjectType >::Type_ 
getObject (const InputType &data) const =0
 Gets the object built from a InputType input.
 BOOST_STATIC_ASSERT (util::IsBasic< InputType >::value)

Detailed Description

template<typename ObjectType, typename InputType>
class keyvalue::BuilderFrom< ObjectType, InputType >

A (possible) base template class of Builder<ObjectType>.

In general, the input data required by Builders are so rich that must be stored in a DataSet. Nevertheless, in some particular cases, a single basic type might be enough. For instance, consider a Builder that creates a curve given a few points on it. Normally, this Builder requires the set of points, an interpolator and an extrapolator. In this general case, a DataSet is necessary to hold all this information. However, when the curve is known to be constant, then a single number - the constant - is enough to build the whole curve. Rather than creating a DataSet to store a single double value, it would be more convenient if the Builder could accept just this value (or more generally, a value::Variant). To have this capability Builders must derive from this template class.

Parameters:
ObjectType : (template parameter) Type of object build by the Builder.
InputType : (template parameter) The basic type the Builder can build from.

Member Function Documentation

virtual value::PtrTraits<ObjectType>::Type_ getObject ( const InputType &  data  )  const [private, pure virtual]

Gets the object built from a InputType input.

This is a pure virtual method which must be implemented by Builders.

Parameters:
data : The input.
Returns:
The object built.