This class represents a basic reference counted object.
Reference counted objects can be used inside intrusive_ptr structures in order to have automatic memory management. For example: intrusive_ptr<Window> mpWindow = new Window();
Internally, reference counted objects store a reference count. That value is increased every time AddRef() is called, and decreased every time Release() is called. When the reference count reaches 0, the object deletes itself. Every AddRef() call must be paired with a Release() call; intrusive_ptr does that automatically.
However, intrusive pointers must be used carefully, since it could case problems on certain cases. For example, class A has an intrusive_ptr<B> member. B has an intrusive_ptr<A> that points to the first object. This causes a recursive dependance that makes those objects never be deleted.
Additionally, this class contains a Cast method, that allows classes to implement an efficient equivalent to dynamic_cast. You can use it directly, but it's recommended to use object_cast instead. For example, to cast an IDrawable* pDrawable; into a IImageDrawable*:
// Cast an IDrawable* pDrawable into a IImageDrawable* IImageDrawable* result = object_cast<IImageDrawable>(pDrawable); // If it can be casted it will return nullptr; it's recommend it to always check if (result) ...
You can use the "ModAPI Object" item template to create a basic Object class that supports casting.
- class App::ICamera
- This class represents a camera in the game, capable of setting the view transformations used for rendering and receiving input events.
- class DefaultObject
- A default implementation of the Object class.
- class Editors::EditorRigblock
- class Palettes::ColorPickerUI
- This class holds all information related with the color picker in editor categories and its user interface.
- class Palettes::PaletteCategory
- A category in an editor palette contains pages.
- class Palettes::PaletteItem
- Represents an item inside a palette page.
- class Palettes::PaletteMain
- This object represents the palette of an editor.
- class Palettes::PalettePage
- A page in an Palettes palette that contains multiple items (Palettes::
- class Resource::AsyncResource
- class Resource::DatabasePackedFile
- A DatabasePackedFile is a type of file used in Spore to store and index multiple files inside a single container (usually in the .package extension).
- class Resource::ResourceObject
- A type of object that is used as a resource.
- class Simulator::cBehaviorBase
- class Simulator::cToolStrategy
- class Simulator::ISerializerStream
- class Simulator::ISimulatorSerializable
- class Sporepedia::cSPAssetDataOTDB
- class Sporepedia::OTDB::cObjectTemplateDB
- class UTFWin::IWinProc
- This class is a window procedure, also known as an event/message listener.
- class UTFWin::LayoutReader
- class UTFWin::UTFWinObject
- static const uint32_t TYPE
- ~Object() protected virtual