User Documentation
RAVL, Recognition And Vision Library
DEVELOP HOME PAGE CLASS LIST CONTENTS
Ravl - Core - IO - Formats - TypeConverterBodyC
 

  PUBLIC
TypeConverterBodyC::TypeConverterBodyC(void)
TypeConverterBodyC::FindConversion(const type_info &,const type_info &,RealT &)
TypeConverterBodyC::FindConversion(const type_info &,const type_info &)
TypeConverterBodyC::CanConvert(const type_info &,const type_info &)
TypeConverterBodyC::DoConvertion(const RCAbstractC &,const type_info &,const type_info &)
TypeConverterBodyC::Insert(DPConverterBaseC &)
TypeConverterBodyC::Remove(DPConverterBaseC &)
TypeConverterBodyC::Graph(void)
RCBodyVC::Save(ostream &) const
RCBodyVC::Save(BinOStreamC &) const
RCBodyVC::Copy(void) const
RCBodyVC::DeepCopy(UIntT) const
RCBodyC::References(void) const
RCBodyC::Copy(void) const
RCBodyC::DeepCopy(UIntT) const
RCBodyC::IncRefCounter(void)
RCBodyC::DecRefCounter(void)

   TypeConverterBodyC   
 
Type converter body.
 
include "Ravl/DP/TypeConverter.hh"
User Level:Develop
Library:RavlIO
In Scope:RavlN

Comments:
This class provides a mechanism for handle conversions between two types. Its main use is converting data held in an abstract handle into a type which a particular piece of code can handle.

It holds the set of available conversions as a graph, and searches for the least cost path between two nodes (c++ types) in the graph.

The cost function attempts to minimise the sum of the data data losses, the costs a represented as ratio of bits of information given to those sent out. e.g. The cost of converting a (32 bit) int into a char is 4 32/8. Strictly speaking the losses should be multiplied, but this gives no preference to shorter conversion paths, so I've chosen to simply add them. If someone comes up with a single example where this crude approximation causes problems I'll put together a more sophisticated scheme, until then it will do.

Parent Classes: Variables:
Methods:
TypeConverterBodyC()
Constructor.

DListC<DPConverterBaseC> FindConversion(const type_info & from,const type_info & to,RealT & finalCost)
Find a conversion.
If found the cost of conversion is put into finalCost.

DListC<DPConverterBaseC> FindConversion(const type_info & from,const type_info & to)
Find a conversion.

bool CanConvert(const type_info & from,const type_info & to)
Test if conversion is possible.

RCAbstractC DoConvertion(const RCAbstractC & dat,const type_info & from,const type_info & to)
Do conversion through abstract handles.

bool Insert(DPConverterBaseC & tc)
Insert new conversion.

bool Remove(DPConverterBaseC & tc)
Remove old conversion.

GraphC<StringC,DPConverterBaseC> & Graph()
Access converstion graph.

#include "Ravl/RCHandleV.hh"
bool Save(ostream & out) const
Save to stream 'out'.

bool Save(BinOStreamC & out) const
Save to binary stream 'out'.

RCBodyVC & Copy() const
Make copy of body.
This should be provided in derived classes. this funtion will issue an assertion failure if called.

RCBodyC & DeepCopy(UIntT levels = ((UIntT))) const
Make a deep copy of body.
This should be provided in derived classes. this funtion will issue an assertion failure if called.

#include "Ravl/RefCounter.hh"
UIntT References() const
Access count of handles open to this object.

RCBodyC & Copy() const
Make copy of body.
This should be provided in derived classes. this funtion will issue an assertion failure if called.

RCBodyC & DeepCopy(UIntT levels = ((UIntT))) const
Make a deep copy of body.
This should be provided in derived classes. this funtion will issue an assertion failure if called.

void IncRefCounter()
Increment reference counter.

bool DecRefCounter()
Decrement reference counter.


Maintainer:Charles Galambos, Documentation by CxxDoc: Tue Aug 13 09:59:02 2002