Shadowrun: Awakened 29 September 2011 - Build 871
Public Member Functions | Protected Attributes
TypeManager::Type< ClassType > Class Template Reference
Inheritance diagram for TypeManager::Type< ClassType >:

List of all members.

Public Member Functions

virtual IReflectcreateInstance ()
virtual size_t getSize ()
virtual const char * getTypeId ()
 Type ()

Protected Attributes

const char * _typeName

Detailed Description

template<class ClassType>
class TypeManager::Type< ClassType >

Implementation of IType using a template class to provide sizing & instantiation

Definition at line 70 of file Reflection.h.


Constructor & Destructor Documentation

template<class ClassType>
TypeManager::Type< ClassType >::Type ( ) [inline]

Constructor Sets the typename for this class

Definition at line 80 of file Reflection.h.

References TypeManager::Type< ClassType >::_typeName.

        {
            //the typeid mechanism maintains type_info instances
            //in at least VS2005, it is safe to hold onto just the name reference
            //this may not be safe in all compilers
            //ClassType type;
            const std::type_info & typeInfo = typeid(ClassType);

            _typeName = typeInfo.name();
        }       

Member Function Documentation

template<class ClassType>
virtual IReflect* TypeManager::Type< ClassType >::createInstance ( ) [inline, virtual]

Creates a new instance of this type

Implements IType.

Definition at line 110 of file Reflection.h.

        {
            //If ClassType does not implement IReflect,
            //then we must be cautious to not cause a memory leak
            ClassType* instance = new ClassType();
            IReflect* reflected = dynamic_cast<IReflect*>(instance);
            if(reflected == NULL)
                delete instance;
            return reflected;
        }
template<class ClassType>
virtual size_t TypeManager::Type< ClassType >::getSize ( ) [inline, virtual]

Gets the memory size of this type in bytes

Implements IType.

Definition at line 102 of file Reflection.h.

        {
            return sizeof(ClassType);
        }
template<class ClassType>
virtual const char* TypeManager::Type< ClassType >::getTypeId ( ) [inline, virtual]

Gets the unique string which identifies this type

Implements IType.

Definition at line 94 of file Reflection.h.

References TypeManager::Type< ClassType >::_typeName.

Referenced by TypeManager::ContainsType(), and TypeManager::GetType().

        {
            return _typeName;
        };

Member Data Documentation

template<class ClassType>
const char* TypeManager::Type< ClassType >::_typeName [protected]

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

Copyright © 2007-2010 by The Shadowrun: Awakened Team. This work is licensed under the GNU Lesser General Public License 3.

GNU Lesser General Public License 3 Sourceforge.net