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) ...
Object is an interface; for a default implementation, check DefaultObject. Object can be considered an equivalent to COM objects.
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::cEditorSkin
- class Editors::EditorAnimations
- class Editors::EditorBaseHandle
- class Editors::EditorRigblock
- Represents a "part" (or rigblock) in an editor.
- 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 RenderWare::IRwResource
- class Resource::Database
- class Resource::IAsyncRequest
- class Resource::ResourceObject
- A type of object that is used as a resource.
- class Simulator::cBehaviorBase
- class Simulator::cToolStrategy
- class Simulator::IScenarioEditHistoryEntry
- A generic entry of undo/redo history in the adventure editor.
- 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
Public static variables
- static const uint32_t TYPE
Constructors, destructors, conversion operators
- ~Object() protected virtual