PrevNextUpHome SophiaFramework UNIVERSE 5.3
SFXTypeInfo
Class which provides the type infomation.
#include <SFXTypeInfo.h.hpp>
class SFXTypeInfo;
SFMTYPEDEFCLASS(SFXTypeInfo)
        

Description

The SFXTypeInfo class provides the type information (SFXTypeInfo::TypeId) of classes and atomic types.

The SFXTypeInfo::GetTypeId function retrives the type infomation from a specified template parameter.

The type information value is unique by types, but the values would be different on the different execution environments even if the types are the same.

[Note] Memo

SFXTypeInfo::TypeId and SFXTypeInfo::GetTypeId are used in the implement of SFXAny.

Reference

SFXTypeInfo::TypeId | SFXTypeInfo::GetTypeId

Member

Public Functions
static
TypeId
GetTypeId( T * param = null )
Get the type information of a specified type.
Types
TypeId
A value which represents the type information.

SFXTypeInfo::GetTypeId
Get the type information of a specified type.
[ public, static ]
TypeId GetTypeId<T>(
    T * param = null   // parameter for type (the value is not concerned)
);

Description

Get the type information (SFXTypeInfo::TypeId) of a specified type as a template parameter.

[Caution] Caution

In Visual C++ 6.0 or RVCT 1.2 for BREW, the argument should be a null pointer that is cast by T pointer type. In this case, no template parameter is need.

Example

Descrimination of types

SFXTypeInfo::TypeId x;

x = SFXTypeInfo::GetTypeId((SInt32Ptr)(null));

if (x == SFXTypeInfo::GetTypeId((SInt32Ptr)(null))) {
    TRACE("x is SInt32");
}
if (x != SFXTypeInfo::GetTypeId((UInt32Ptr)(null))) {
    TRACE("x is not UInt32");
}

// This syntax can also be used in the following compilers.
// Visual C++ .NET 2003 or over, RVCT for BREW 3.0 or over, GNUARM 4.1 and YAGARTO 4.4
#if !((defined TARGET_COMPILER_MSVCPP && TARGET_COMPILER_VERSION < 1300) || (defined TARGET_COMPILER_ARMCPP && TARGET_COMPILER_VERSION < 300000))
if (x == SFXTypeInfo::GetTypeId<SInt32>()) {
    TRACE("x is SInt32");
}
if (x != SFXTypeInfo::GetTypeId<UInt32>()) {
    TRACE("x is not UInt32");
}
#endif

// [Results]
// x is SInt32
// x is not UInt32
// x is SInt32
// x is not UInt32

Reference

SFXTypeInfo::TypeId


SFXTypeInfo::TypeId
A value which represents the type information.
typedef Void (*_sfxtypeinfo_type_id)(VoidPtr param);

[public]
SFMTYPEDEFALIAS(_sfxtypeinfo_type_id, TypeId)

Description

This is a type information value which is retrived by the SFXTypeInfo::GetTypeId function.

The type information value is unique by types, but the values would be different on the different execution environments even if the types are the same.

Reference

SFXTypeInfo::GetTypeId