IECore::RunTimeTyped Class Reference

#include <RunTimeTyped.h>

Inheritance diagram for IECore::RunTimeTyped:

IECore::RefCounted IECore::DisplayDriver IECore::DisplayDriver::DisplayDriver::DisplayDriverCreator IECore::DisplayDriverServer IECore::FileSequence IECore::Font IECore::FrameList IECore::Object IECore::Parameter IECore::Parameterised IECore::PrimitiveEvaluator IECore::Renderer IECoreGL::Bindable IECoreGL::Font IECoreGL::Renderable

List of all members.

Classes

struct  TypeDescription

Public Types

typedef RefCounted BaseClass
 A typedef for the class this class derives from. All RunTimeTyped classes define this typedef.

Public Member Functions

 IE_CORE_DECLAREMEMBERPTR (RunTimeTyped)
 RunTimeTyped ()
virtual ~RunTimeTyped ()

Protected Types

typedef std::map< TypeId, TypeIdBaseTypeRegistryMap
typedef std::map< TypeId,
std::vector< TypeId > > 
BaseTypesRegistryMap
typedef std::map< TypeId,
std::set< TypeId > > 
DerivedTypesRegistryMap
typedef std::map< TypeId,
std::string > 
TypeIdsToTypeNamesMap
typedef std::map< std::string,
TypeId
TypeNamesToTypeIdsMap

Static Protected Member Functions

static BaseTypeRegistryMapbaseTypeRegistry ()
static DerivedTypesRegistryMapderivedTypesRegistry ()
static BaseTypesRegistryMapcompleteBaseTypesRegistry ()
static DerivedTypesRegistryMapcompleteDerivedTypesRegistry ()
static void derivedTypeIdsWalk (TypeId typeId, std::set< TypeId > &)
static TypeIdsToTypeNamesMaptypeIdsToTypeNames ()
static TypeNamesToTypeIdsMaptypeNamesToTypeIds ()

Type identification functions.

These functions provide useful queries about the typing of both classes and instances. They must be reimplemented appropriately in all derived classes. This is achieved through the use of the IE_CORE_DECLARERUNTIMETYPED macro.

virtual TypeId typeId () const
virtual const char * typeName () const
virtual bool isInstanceOf (TypeId typeId) const
virtual bool isInstanceOf (const char *typeName) const
static TypeId staticTypeId ()
 Returns the TypeId for this class, without needing an instance.
static const char * staticTypeName ()
 Returns the type name for this class, without needing an instance.
static TypeId baseTypeId ()
static const char * baseTypeName ()
static bool inheritsFrom (TypeId typeId)
 Returns true if this class inherits from the specified type.
static bool inheritsFrom (const char *typeName)
 Returns true if this class inherits from the specified type.
static TypeId baseTypeId (TypeId typeId)
 Returns the base type of the given type, or InvalidTypeId if no such base exists.
static const std::vector
< TypeId > & 
baseTypeIds (TypeId typeId)
static const std::set< TypeId > & derivedTypeIds (TypeId typeId)
static TypeId typeIdFromTypeName (const char *typeName)
static const char * typeNameFromTypeId (TypeId typeId)
static void registerType (TypeId derivedTypeId, const char *derivedTypeName, TypeId baseTypeId)
 Allows external modules to register their own type ids.


Detailed Description

An abstract base class for objects whose type we wish to determine at runtime. The rationale for using such a type system rather than the std c++ typeid() stuff is as follows :

1) The GCC implentation of the C++ system breaks down with templated types across module boundaries.

2) We wish to use the type system to identify the type of serialised objects in files (see the serialisation interface defined in Object), but the C++ type_info object provides us with no information we can usefully use for that.


Member Typedef Documentation

A typedef for the class this class derives from. All RunTimeTyped classes define this typedef.

Reimplemented in IECoreGL::TypedStateComponent< T, TId >.

typedef std::map< TypeId, TypeId > IECore::RunTimeTyped::BaseTypeRegistryMap [protected]

typedef std::map< TypeId, std::vector<TypeId> > IECore::RunTimeTyped::BaseTypesRegistryMap [protected]

typedef std::map< TypeId, std::set< TypeId > > IECore::RunTimeTyped::DerivedTypesRegistryMap [protected]

typedef std::map<TypeId, std::string> IECore::RunTimeTyped::TypeIdsToTypeNamesMap [protected]

typedef std::map<std::string, TypeId> IECore::RunTimeTyped::TypeNamesToTypeIdsMap [protected]


Constructor & Destructor Documentation

RunTimeTyped::RunTimeTyped (  ) 

RunTimeTyped::~RunTimeTyped (  )  [virtual]


Member Function Documentation

TypeId RunTimeTyped::baseTypeId ( TypeId  typeId  )  [static]

Returns the base type of the given type, or InvalidTypeId if no such base exists.

References baseTypeRegistry(), and IECore::InvalidTypeId.

TypeId RunTimeTyped::baseTypeId (  )  [static]

Returns the TypeId of the base of this class, without needing an instance. The base type of RunTimeTyped itself is defined to be InvalidTypeId;

Reimplemented in IECoreGL::TypedStateComponent< T, TId >.

References IECore::InvalidTypeId.

Referenced by baseTypeIds(), and IECoreMaya::ParameterHandler::create().

const std::vector< TypeId > & RunTimeTyped::baseTypeIds ( TypeId  typeId  )  [static]

Returns all bases of the given type, or an empty vector if no such bases exist. The elements are ordered by "distance" from the given TypeId. That is to say, the first element will be the immediate base class, and the last elemenet will be RunTimeTyped. Should not be called during static initialization as it's likely that not all types will have been registered at that point, so to do so would yield an incomplete list.

References baseTypeId(), completeBaseTypesRegistry(), and IECore::InvalidTypeId.

const char * RunTimeTyped::baseTypeName (  )  [static]

Returns the type name of the base of this class, without needing an instance. The base type name of RunTimeTyped itself is defined to be "InvalidType";

Reimplemented in IECoreGL::TypedStateComponent< T, TId >.

RunTimeTyped::BaseTypeRegistryMap & RunTimeTyped::baseTypeRegistry (  )  [static, protected]

Referenced by baseTypeId(), and registerType().

RunTimeTyped::BaseTypesRegistryMap & RunTimeTyped::completeBaseTypesRegistry (  )  [static, protected]

Referenced by baseTypeIds().

RunTimeTyped::DerivedTypesRegistryMap & RunTimeTyped::completeDerivedTypesRegistry (  )  [static, protected]

Referenced by derivedTypeIds().

const std::set< TypeId > & RunTimeTyped::derivedTypeIds ( TypeId  typeId  )  [static]

Returns all derived types of the given type, or an empty set if no such derived types exist. Should not be called during static initialization as it's likely that not all types will have been registered at that point, so to do so would yield an incomplete list.

References completeDerivedTypesRegistry(), and derivedTypeIdsWalk().

Referenced by IECoreHoudini::FromHoudiniGeometryConverter::create(), IECore::Writer::supportedExtensions(), and IECore::Reader::supportedExtensions().

void RunTimeTyped::derivedTypeIdsWalk ( TypeId  typeId,
std::set< TypeId > &  typeIds 
) [static, protected]

Termination condition: No derived types

References derivedTypesRegistry().

Referenced by derivedTypeIds().

RunTimeTyped::DerivedTypesRegistryMap & RunTimeTyped::derivedTypesRegistry (  )  [static, protected]

Referenced by derivedTypeIdsWalk(), and registerType().

IECore::RunTimeTyped::IE_CORE_DECLAREMEMBERPTR ( RunTimeTyped   ) 

bool RunTimeTyped::inheritsFrom ( const char *  typeName  )  [static]

Returns true if this class inherits from the specified type.

Reimplemented in IECoreGL::TypedStateComponent< T, TId >.

bool RunTimeTyped::inheritsFrom ( TypeId  typeId  )  [static]

Returns true if this class inherits from the specified type.

Reimplemented in IECoreGL::TypedStateComponent< T, TId >.

bool RunTimeTyped::isInstanceOf ( const char *  typeName  )  const [virtual]

Returns true if this object is an instance of the specified type, or of a class inherited from the specified type.

Reimplemented in IECoreGL::TypedStateComponent< T, TId >.

References staticTypeName().

bool RunTimeTyped::isInstanceOf ( TypeId  typeId  )  const [virtual]

Returns true if this object is an instance of the specified type, or of a class inherited from the specified type.

Reimplemented in IECoreGL::TypedStateComponent< T, TId >.

References staticTypeId().

Referenced by IECore::Object::copyFrom(), and IECore::ObjectParameter::valueValid().

void RunTimeTyped::registerType ( TypeId  derivedTypeId,
const char *  derivedTypeName,
TypeId  baseTypeId 
) [static]

Allows external modules to register their own type ids.

Use the lower-bound as a hint for the position, yielding constant insert time

Inserted derived type id into set of base classes derived type ids

Put in id->name map

Use the lower-bound as a hint for the position, yielding constant insert time

Put in name->id map

Use the lower-bound as a hint for the position, yielding constant insert time

References baseTypeRegistry(), derivedTypesRegistry(), IECore::msg(), typeIdFromTypeName(), typeIdsToTypeNames(), typeNameFromTypeId(), typeNamesToTypeIds(), and IECore::MessageHandler::Warning.

TypeId RunTimeTyped::staticTypeId (  )  [static]

const char * RunTimeTyped::staticTypeName (  )  [static]

TypeId RunTimeTyped::typeId (  )  const [virtual]

TypeId RunTimeTyped::typeIdFromTypeName ( const char *  typeName  )  [static]

Returns the corresponding TypeId for the specified typeName, or InvalidTypeId if typeName is not a registered type.

References IECore::InvalidTypeId, and typeNamesToTypeIds().

Referenced by registerType().

RunTimeTyped::TypeIdsToTypeNamesMap & RunTimeTyped::typeIdsToTypeNames (  )  [static, protected]

Referenced by registerType(), and typeNameFromTypeId().

const char * RunTimeTyped::typeName (  )  const [virtual]

const char * RunTimeTyped::typeNameFromTypeId ( TypeId  typeId  )  [static]

Returns the corresponding typeName for the specified TypeId, or InvalidTypeId if typeId is not a registered type.

References typeIdsToTypeNames().

Referenced by IECore::DataCastOp::doOperation(), IECore::YUVImageWriter::YUVImageWriter::ChannelConverter::YUVImageWriter::ChannelConverter::ErrorHandler::operator()(), IECore::UniformRandomPointDistributionOp::UniformRandomPointDistributionOp::DistributeFn::UniformRandomPointDistributionOp::DistributeFn::ErrorHandler::operator()(), IECore::TriangulateOp::TriangulateOp::TriangulateFn::TriangulateOp::TriangulateFn::ErrorHandler::operator()(), IECore::TIFFImageWriter::TIFFImageWriter::ChannelConverter< ChannelData >::TIFFImageWriter::ChannelConverter::ErrorHandler::operator()(), IECore::TGAImageWriter::TGAImageWriter::ChannelConverter::TGAImageWriter::ChannelConverter::ErrorHandler::operator()(), IECore::MeshPrimitiveShrinkWrapOp::MeshPrimitiveShrinkWrapOp::ShrinkWrapFn::MeshPrimitiveShrinkWrapOp::ShrinkWrapFn::ErrorHandler::operator()(), IECore::JPEGImageWriter::JPEGImageWriter::ChannelConverter::JPEGImageWriter::ChannelConverter::ErrorHandler::operator()(), IECore::ImageCompositeOp::ImageCompositeOp::ChannelConverter::ImageCompositeOp::ChannelConverter::ErrorHandler::operator()(), IECore::DPXImageWriter::DPXImageWriter::ChannelConverter::DPXImageWriter::ChannelConverter::ErrorHandler::operator()(), IECore::DataPromoteOp::DataPromoteOp::Promote1Fn::DataPromoteOp::Promote1Fn::Func< F, typename boost::enable_if< TypeTraits::IsNumericSimpleTypedData< F > >::type >::operator()(), IECore::DataPromoteOp::DataPromoteOp::Promote1Fn::DataPromoteOp::Promote1Fn::Func< F, typename boost::enable_if< TypeTraits::IsNumericVectorTypedData< F > >::type >::operator()(), IECore::CurveExtrudeOp::CurveExtrudeOp::UniformFn::CurveExtrudeOp::UniformFn::ErrorHandler::operator()(), IECore::CurveExtrudeOp::CurveExtrudeOp::VertexFn::CurveExtrudeOp::VertexFn::ErrorHandler::operator()(), IECore::CurveExtrudeOp::CurveExtrudeOp::VaryingFn::CurveExtrudeOp::VaryingFn::ErrorHandler::operator()(), IECore::CINImageWriter::CINImageWriter::ChannelConverter::CINImageWriter::ChannelConverter::ErrorHandler::operator()(), registerType(), and IECore::ObjectParameter::valueValid().

RunTimeTyped::TypeNamesToTypeIdsMap & RunTimeTyped::typeNamesToTypeIds (  )  [static, protected]

Referenced by registerType(), and typeIdFromTypeName().


The documentation for this class was generated from the following files:

Generated on Mon Jan 24 11:13:27 2011 for Cortex by doxygen 1.5.8