nomlib
Loading...
Searching...
No Matches
nom::IObject Class Reference

Root object hierarchy for object type identification (RTTI). More...

#include <IObject.hpp>

Inheritance diagram for nom::IObject:
[legend]

Public Types

typedef IObject self_type
typedef IObjectraw_ptr

Public Member Functions

 IObject (void)
 Default constructor.
virtual ~IObject (void)
 Virtual destructor.
virtual ObjectTypeInfo type (void) const
 Obtain the object's class type.
virtual bool is_type (const ObjectTypeInfo &rhs) const
 Compare this object type with another object's type.

Static Public Member Functions

template<typename Base, typename Derived>
static bool is_a (const Derived object)
 Compare two objects to determine if a derived class inherits from a base class object.
static void * operator new (nom::size_type mem)
static void operator delete (void *ptr)

Static Public Attributes

static uint64 total_alloc_bytes
static uint64 total_dealloc_bytes

Detailed Description

Member Typedef Documentation

◆ raw_ptr

typedef IObject* nom::IObject::raw_ptr

Definition at line 46 of file IObject.hpp.

◆ self_type

typedef IObject nom::IObject::self_type

Definition at line 44 of file IObject.hpp.

Member Function Documentation

◆ is_a()

template<typename Base, typename Derived>
bool nom::IObject::is_a ( const Derived object)
inlinestatic

Compare two objects to determine if a derived class inherits from a base class object.

Returns
Boolean TRUE if the derived object inherits from the specified base class, boolean FALSE if the derived object does not inherit from the specified base class.
Remarks
Example uses of this include checking to see if an nom::IDrawable object of inherits nom::Transformable, in order to perform transformations on the object before its ready for rendering.

Definition at line 104 of file IObject.hpp.

◆ is_type()

virtual bool nom::IObject::is_type ( const ObjectTypeInfo & rhs) const
virtual

Compare this object type with another object's type.

Returns
The default implementation returns boolean TRUE if the comparison of nom::IObject object's type is the same (identical) as the other specified object, or boolean FALSE if the comparison of nom::IObject object's type against the other is not identical.
Remarks
Example re-implementation examples could include usage of static_cast or dynamic_cast in order to determine more complicated object type hierarchies, such as an object derived from a base class.

◆ type()

virtual ObjectTypeInfo nom::IObject::type ( void ) const
virtual

Obtain the object's class type.

Returns
The object's uniquely identifying class type; the default implementation of this method will always return IObject's type.
Remarks
This method should be overridden anytime you need to do things like identify particular object type(s) – i.e.: nom::Sprite objects within a larger group of objects, such as a the typical std::vector of nom::IDrawable objects.

Generally, you can get away with a simple declaration, like so:

ObjectTypeInfo ExampleClass::type( void ) const
{
return NOM_OBJECT_TYPE( ExampleClassName );
}
Run-time type information (RTTI) container class.
Note
See also: NOM_OBJECT_TYPE_INFO macro.

Reimplemented in nom::Decorator, nom::FinalFantasyDecorator, nom::FinalFantasyFrame, nom::Gradient, nom::IDrawable, nom::Line, nom::MinimalDecorator, nom::Rectangle, nom::Shape, nom::Sprite, nom::SpriteBatch, nom::Text, and nom::Transformable.

Member Data Documentation

◆ total_alloc_bytes

uint64 nom::IObject::total_alloc_bytes
static

Definition at line 48 of file IObject.hpp.

◆ total_dealloc_bytes

uint64 nom::IObject::total_dealloc_bytes
static

Definition at line 49 of file IObject.hpp.


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