Implementing typekit for types composed themselves of other self-defined types

Hi,

I'm still busy constructing the BFL typekit.
So far I have been able to include typekit support for Probability
(just a class containing a double), ColumnVector and RowVector (using
SequenceTypeInfo).
No I try to make support for the WeightedSample type.
WeightedSample is a templateclass: and each WeightedSample has a value
of the templatetype (ValueGet()) and weight (a double) (WeightGet()).

>From the documentation I was not sure how you can construct a typekit
for types which are themselves consisting of other self-defined types.
Should I inherit from StructTypeInfo or from TempalteTypeInfo?
Do I have to implement the serialize function and how?

In 1.10: I implemented a composeProperty and decomposeProperty
function (for composeProperty see below):

template<class T>
bool composeProperty(const PropertyBag& bag, WeightedSample<T>&
weightedSample)
{
//log(Debug) << "composeProperty of WeightedSample " <<
endlog();
std::string tname = detail::DataSourceTypeInfo<T>::getType();
if ( bag.getType() == std::string("WeightedSample") ) {
// Get values of sample
Property<PropertyBag>* el_bag =
bag.getProperty<PropertyBag>("WeightedSampleValue");

if(el_bag==NULL){
// Works for properties in WeightedSample
PropertyBase* element = bag.getItem( 0 );
//log(Debug)<<element->getName()<<", "<<
element->getDescription()<<endlog();
Property<T> my_property_t
(element->getName(),element->getDescription());
if(my_property_t.getType()!=element->getType())
{
log(Error)<< "Type of "<< element->getName() << "
does not match type of WeightedSample"<< "OR "<<"Could not read
WeightedSample Value "<<endlog();
return false;
}
else{

my_property_t.getTypeInfo()->composeType(element->getDataSource(),my_property_t.getDataSource());
weightedSample.ValueSet( my_property_t.get());
}
}
else{
// Works for propertybags in WeightedSample
const std::string el_bagType = el_bag->getType();
Property<T >
el_p(el_bag->getName(),el_bag->getDescription());

if(!(el_p.getDataSource()->composeType(el_bag->getDataSource()))){
log(Error)<<"Could not compose WeightedSampleValue
"<<endlog();
return false;
}
if(el_p.ready()){
weightedSample.ValueSet( el_p.get());
}else{
log(Error)<<"Property of WeightedSampleValue was
not ready for use"<<endlog();
return false;
}
}
// Get weight of sample
Property<double>* weightProp =
bag.getProperty<double>("WeightedSampleWeight");

if(!weightProp)
{
log(Error)<< "Error reading weight of
WeightedSample"<<endlog();
return false;
}
else{
weightedSample.WeightSet( weightProp->get());
}
}
else {
Logger::log() << Logger::Error << "Composing Property<
WeightedSample<T> > :"
<< " type mismatch, got type '"<<
bag.getType()
<< "', expected type
"<<tname<<"."<<Logger::endl;
return false;
}
return true;
};

Any suggestions how to proceed?

Tinne