Developer Documentation |
RAVL, Recognition And Vision Library |
PUBLIC |
TypeConverterC::TypeConverterC(void)
TypeConverterC::TypeConverterC(bool)
TypeConverterC::FindConversion(const type_info &,const type_info &,RealT &)
TypeConverterC::FindConversion(const type_info &,const type_info &)
TypeConverterC::CanConvert(const type_info &,const type_info &)
TypeConverterC::DoConvertion(const RCAbstractC &,const type_info &,const type_info &)
TypeConverterC::Insert(DPConverterBaseC &)
TypeConverterC::Remove(DPConverterBaseC &)
TypeConverterC::TypeConvert(const InT &,OutT &)
TypeConverterC::TypeConvert(const RCWrapAbstractC &,OutT &)
TypeConverterC::Graph(void)
RCHandleC::operator =(const RCHandleC &)
RCHandleC::DeepCopy(UIntT) const
RCHandleC::operator ==(const RCHandleC &) const
RCHandleC::operator !=(const RCHandleC &) const
RCHandleC::Hash(void) const
RCHandleC::IsValid(void) const
RCHandleC::Invalidate(void)
RCHandleC::IsHandleType(const DT &) const
RCHandleC::CheckHandleType(const DT &) const
RCHandleC::Body(void)
RCHandleC::Body(void) const
RCHandleC::References(void) const
RCHandleC::operator <<(ostream &,const RCHandleC &)
RCHandleC::operator >>(istream &,RCHandleC &)
|
TypeConverterC
|
|
Type converter.
|
|
include | "Ravl/DP/TypeConverter.hh" |
Source file: | Ravl/Core/IO/TypeConverter.hh |
User Level: | Advanced |
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:
Methods:
- TypeConverterC()
-
Default constructor.
- TypeConverterC(bool)
-
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.
- bool TypeConvert(const InT & inraw,OutT & outraw)
-
Do a conversion.
This is really only for testing, if you know exactly what the
types of the objects are you can convert directly.
- bool TypeConvert(const RCWrapAbstractC & in,OutT & outraw)
-
Do a conversion from an object held in an abstract handle.
- GraphC<StringC,DPConverterBaseC> & Graph()
-
Access converstion graph.
- const RCHandleC<TypeConverterBodyC> & operator =(const RCHandleC<TypeConverterBodyC> & oth)
-
Assign handle.
- RCHandleC<TypeConverterBodyC> DeepCopy(UIntT levels = ((UIntT))) const
-
Do a deep copy of the object.
- bool operator ==(const RCHandleC<TypeConverterBodyC> & oth) const
-
Are handles to the same object ?
- bool operator !=(const RCHandleC<TypeConverterBodyC> & oth) const
-
Are handles to different objects ?
- UIntT Hash() const
-
Default hash function.
This hashes on the address of the body.
- bool IsValid() const
-
Test if this is a valid handle.
- void Invalidate()
-
Invalidate this handle.
Unattaches the body from the handle.
- bool IsHandleType(const DT &) const
-
Is handle of given type ?
- void CheckHandleType(const DT & dummy) const
-
Check handle type. Throw an expception if not.
- TypeConverterBodyC & Body()
-
Access body of object.
- const TypeConverterBodyC & Body() const
-
Constant access to body of object.
- UIntT References() const
-
Find the number of references to the body of this object.
- ostream & operator <<(ostream & strm,const RCHandleC<TypeConverterBodyC> & obj)
-
- istream & operator >>(istream & strm,RCHandleC<TypeConverterBodyC> & obj)
-
Maintainer:Charles Galambos, Documentation by CxxDoc: Tue Aug 13 09:59:30 2002
|