Rebel Fork Framework
Urho3D::Object Class Referenceabstract

#include <Urho3D/Core/Object.h>

Inheritance diagram for Urho3D::Object:
Urho3D::RefCounted Urho3D::AbstractConnection Urho3D::ActionManager Urho3D::Application Urho3D::ApplicationState Urho3D::AssetTransformerHierarchy Urho3D::Audio Urho3D::BaseWidget Urho3D::BatchCompositor Urho3D::BatchRenderer Urho3D::CameraProcessor Urho3D::ClientReplicaClock Urho3D::ConfigFile Urho3D::Console Urho3D::CubemapRenderer Urho3D::CustomBackbufferTexture Urho3D::DebugHud Urho3D::DefaultUIBatchStateCache Urho3D::Detail::RmlRenderer Urho3D::DirectionAggregator Urho3D::DirectionalPadAdapter Urho3D::DrawableProcessor Urho3D::DrawableProcessorPass Urho3D::DynamicIndexBuffer Urho3D::DynamicModule Urho3D::DynamicVertexBuffer Urho3D::Engine Urho3D::File Urho3D::FileSelector Urho3D::FileSystem Urho3D::FileSystemReflection Urho3D::FileWatcher Urho3D::Geometry Urho3D::GLTFImporter Urho3D::Graph Urho3D::Graphics Urho3D::GraphNode Urho3D::Input Urho3D::InstancingBuffer Urho3D::LANDiscoveryManager Urho3D::LightmapRenderPipelineView Urho3D::Localization Urho3D::Log Urho3D::MaterialInspectorWidget Urho3D::MessageBox Urho3D::Microphone Urho3D::ModelView Urho3D::MountPoint Urho3D::MultiFileWatcher Urho3D::MultitouchAdapter Urho3D::NamedPipe Urho3D::Network Urho3D::NetworkConnection Urho3D::NetworkServer Urho3D::NodeInspectorWidget Urho3D::OcclusionBuffer Urho3D::OpenXRControllerModel Urho3D::ParticleGraph Urho3D::ParticleGraphSystem Urho3D::PipelineStateBuilder Urho3D::Plugin Urho3D::PluginApplication Urho3D::PluginManager Urho3D::PluginStack Urho3D::PointerAdapter Urho3D::PostProcessPass Urho3D::RenderBuffer Urho3D::RenderBufferManager Urho3D::Renderer Urho3D::RenderPipelineView Urho3D::Resource Urho3D::ResourceCache Urho3D::ResourceRouter Urho3D::RmlNavigationManager Urho3D::RmlUI Urho3D::SceneHierarchyWidget Urho3D::SceneProcessor Urho3D::Script Urho3D::Serializable Urho3D::SerializableInspectorWidget Urho3D::ServerReplicator Urho3D::ShaderProgramCompositor Urho3D::ShadowMapAllocator Urho3D::SoftwareModelAnimator Urho3D::StateManager Urho3D::StaticPipelineStateCache Urho3D::SystemMessageBox Urho3D::SystemUI Urho3D::Time Urho3D::UI Urho3D::Viewport Urho3D::VirtualFileSystem Urho3D::VirtualReality Urho3D::WorkQueue Urho3D::XRActionGroup Urho3D::XRBinding

Public Member Functions

 Object (Context *context)
 ~Object () override
 Destruct. Clean up self from event sender & receiver structures.
virtual StringHash GetType () const =0
virtual const ea::string & GetTypeName () const =0
virtual const TypeInfoGetTypeInfo () const =0
 Return type info.
virtual bool IsInstanceOf (StringHash type) const =0
 Check whether current instance implements specified type.
virtual void OnEvent (Object *sender, StringHash eventType, VariantMap &eventData)
 Handle event.
virtual void SerializeInBlock (Archive &archive)
 Serialize content from/to archive. May throw ArchiveException.
template<typename T >
bool IsInstanceOf () const
 Check current instance is type of specified class.
template<typename T >
T * Cast ()
 Cast the object to specified most derived class.
template<typename T >
const T * Cast () const
 Cast the object to specified most derived class.
void SubscribeToEventManual (StringHash eventType, EventHandler *handler)
 Subscribe to an event that can be sent by any sender.
void SubscribeToEventManual (Object *sender, StringHash eventType, EventHandler *handler)
 Subscribe to a specific sender's event.
template<class T >
void SubscribeToEvent (StringHash eventType, T handler)
 Subscribe to an event that can be sent by any sender.
template<class T >
void SubscribeToEvent (Object *sender, StringHash eventType, T handler)
 Subscribe to a specific sender's event.
void UnsubscribeFromEvent (StringHash eventType)
 Unsubscribe from an event.
void UnsubscribeFromEvent (Object *sender, StringHash eventType)
 Unsubscribe from a specific sender's event.
void UnsubscribeFromEvents (Object *sender)
 Unsubscribe from a specific sender's events.
void UnsubscribeFromAllEvents ()
 Unsubscribe from all events.
void UnsubscribeFromAllEventsExcept (const ea::vector< StringHash > &exceptions)
 Unsubscribe from all events except those listed.
void UnsubscribeFromAllEventsExcept (const ea::vector< Object * > &exceptions)
 Unsubscribe from all events except those with listed senders.
void SendEvent (StringHash eventType)
 Send event to all subscribers.
void SendEvent (StringHash eventType, VariantMap &eventData)
 Send event with parameters to all subscribers.
VariantMapGetEventDataMap () const
 Return a preallocated map for event data. Used for optimization to avoid constant re-allocation of event data maps.
template<typename... Args>
void SendEvent (StringHash eventType, const Args &... args)
 Send event with variadic parameter pairs to all subscribers. The parameters are (paramID, paramValue) pairs.
ContextGetContext () const
 Return execution context.
const VariantGetGlobalVar (StringHash key) const
const VariantMapGetGlobalVars () const
void SetGlobalVar (StringHash key, const Variant &value)
ObjectGetSubsystem (StringHash type) const
 Return subsystem by type.
ObjectGetEventSender () const
 Return active event sender. Null outside event handling.
EventHandlerGetEventHandler () const
 Return active event handler. Null outside event handling.
bool HasSubscribedToEvent (StringHash eventType) const
 Return whether has subscribed to an event without specific sender.
bool HasSubscribedToEvent (Object *sender, StringHash eventType) const
 Return whether has subscribed to a specific sender's event.
bool HasEventHandlers () const
 Return whether has subscribed to any event.
template<class T >
T * GetSubsystem () const
 Template version of returning a subsystem.
const ea::string & GetCategory () const
void SendEvent (StringHash eventType, const VariantMap &eventData)
 Send event with parameters to all subscribers.
void SetBlockEvents (bool block)
 Block object from sending and receiving events.
bool GetBlockEvents () const
 Return sending and receiving events blocking status.
- Public Member Functions inherited from Urho3D::RefCounted
 RefCounted ()
 Construct. Allocate the reference count structure and set an initial self weak reference.
virtual ~RefCounted ()
 Destruct. Mark as expired and also delete the reference count structure if no outside weak references exist.
 RefCounted (const RefCounted &rhs)=delete
 Prevent copy construction.
RefCountedoperator= (const RefCounted &rhs)=delete
 Prevent assignment.
int AddRef ()
int ReleaseRef ()
int Refs () const
int WeakRefs () const
RefCountRefCountPtr () const
 Return pointer to the reference count structure.
bool HasScriptObject () const
 Return true if script runtime object wrapping this native object exists.
bool IsScriptStrongRef () const
 Return true if script reference is strong.

Static Public Member Functions

static const TypeInfoGetTypeInfoStatic ()
 Return type info static.

Static Public Attributes

static constexpr ea::array< StringHash, 0 > TypeHierarchy {}

Protected Attributes

WeakPtr< Contextcontext_
 Execution context.

Private Member Functions

const SubsystemCacheGetSubsystems () const
 Return all subsystems from Context.
ea::intrusive_list< EventHandler >::iterator FindEventHandler (StringHash eventType)
 Find the first event handler with no specific sender.
ea::intrusive_list< EventHandler >::iterator FindEventHandler (StringHash eventType) const
 Find the first event handler with no specific sender.
ea::intrusive_list< EventHandler >::iterator FindSpecificEventHandler (Object *sender)
 Find the first event handler with specific sender.
ea::intrusive_list< EventHandler >::iterator FindSpecificEventHandler (Object *sender) const
 Find the first event handler with specific sender.
ea::intrusive_list< EventHandler >::iterator FindSpecificEventHandler (Object *sender, StringHash eventType)
 Find the first event handler with specific sender and event type.
ea::intrusive_list< EventHandler >::iterator FindSpecificEventHandler (Object *sender, StringHash eventType) const
 Find the first event handler with specific sender and event type.
ea::intrusive_list< EventHandler >::iterator EraseEventHandler (ea::intrusive_list< EventHandler >::iterator handlerIter)
 Erase event handler from the list.
void RemoveEventSender (Object *sender)
 Remove event handlers related to a specific sender.

Private Attributes

ea::intrusive_list< EventHandlereventHandlers_
 Event handlers. Sender is null for non-specific handlers.
bool blockEvents_
 Block object from sending and receiving any events.


class Context

Detailed Description

Base class for objects with type identification, subsystem access and event sending/receiving capability.

Member Function Documentation

◆ GetCategory()

const ea::string & Urho3D::Object::GetCategory ( ) const

Return object category. Categories are (optionally) registered along with the object factory. Return an empty string if the object category is not registered.

◆ GetGlobalVar()

const Variant & Urho3D::Object::GetGlobalVar ( StringHash  key) const

Return global variable based on key.

◆ GetGlobalVars()

const VariantMap & Urho3D::Object::GetGlobalVars ( ) const

Return all global variables.

◆ GetType()

virtual StringHash Urho3D::Object::GetType ( ) const
pure virtual

Return type hash.

◆ GetTypeName()

virtual const ea::string& Urho3D::Object::GetTypeName ( ) const
pure virtual

Return type name.

◆ SetGlobalVar()

void Urho3D::Object::SetGlobalVar ( StringHash  key,
const Variant value 

Set global variable with the respective key and value.

Member Data Documentation

◆ TypeHierarchy

constexpr ea::array<StringHash, 0> Urho3D::Object::TypeHierarchy {}

Array of types marked with URHO3D_OBJECT in the hierarchy of this class, from most- to least- derived. Never includes Object class itself.

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