Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

SH::ShCastManager Class Reference

Collaboration diagram for SH::ShCastManager:

Collaboration graph
[legend]
List of all members.

Public Member Functions

void addCast (const ShVariantCast *caster, bool automatic)
void init ()
int castDist (ShValueType destValueType, ShValueType srcValueType)
std::ostream & graphvizDump (std::ostream &out) const
Adds the given statement before the statements in this block

void doCast (ShVariant *dest, const ShVariant *src)
 Casts the contents of the src variant to dest variant Both must be previously allocated and the same size, and caller should check dest != src.
bool doAllocCast (ShVariant *&dest, ShVariant *src, ShValueType valueType, ShDataType dataType)
 Casts src to the requested type and puts the result in dest or if no casting is necessary, or src = 0, simply makes dest = src.
bool doAllocCast (const ShVariant *&dest, const ShVariant *src, ShValueType valueType, ShDataType dataType)

Static Public Member Functions

static ShCastManagerinstance ()

Protected Types

typedef ShPairPairHashMap<
ShValueType, ShDataType,
ShValueType, ShDataType,
const ShVariantCast * > 
FirstCastMap
typedef ShPairHashMap< ShValueType,
ShValueType, int > 
CastDistMap

Protected Attributes

ShCastMgrGraph m_casts
FirstCastMap m_castStep
CastDistMap m_autoDist

Static Protected Attributes

static ShCastManagerm_instance

Detailed Description

Definition at line 118 of file ShCastManager.hpp.


Member Function Documentation

bool SH::ShCastManager::doAllocCast ShVariant *&  dest,
ShVariant src,
ShValueType  valueType,
ShDataType  dataType
 

Casts src to the requested type and puts the result in dest or if no casting is necessary, or src = 0, simply makes dest = src.

Returns:
true iff a new variant was allocated (caller is responsible for deallocation with delete)

Definition at line 188 of file ShCastManager.cpp.

References doCast(), SH::ShVariantFactory::generate(), SH::shVariantFactory(), SH::ShVariant::size(), and SH::ShVariant::typeMatches().

Referenced by doAllocCast(), and SH::ShEval::operator()().

void SH::ShCastManager::doCast ShVariant dest,
const ShVariant src
 

Casts the contents of the src variant to dest variant Both must be previously allocated and the same size, and caller should check dest != src.

When dest, src have same type, this just becomes a data copy.

Definition at line 151 of file ShCastManager.cpp.

References SH::ShVariant::dataType(), SH::ShVariantCast::doCast(), SH::ShVariantFactory::generate(), SH::ShVariantCast::getDestTypes(), m_castStep, SH::shValueTypeName(), SH::shVariantFactory(), SH::ShVariant::size(), and SH::ShVariant::valueType().

Referenced by doAllocCast(), SH::ShEval::operator()(), and SH::ShDataVariant< T, DT >::set().


The documentation for this class was generated from the following files:
Generated on Wed Jun 15 18:15:09 2005 for Sh by  doxygen 1.4.3-20050530