omni::core::IObject

Defined in omni/core/IObject.h

class IObject : public omni::core::Generated<omni::core::IObject_abi>

Base class for all.

ABI-safe interfaces. Provides references counting and an ABI-safe dynamic_cast like mechanism.

When defining a new interface, use the Inherits template.

When implementing one or more interfaces use the omni::core::Implements template.

See Omniverse Native Interfaces to understand the overall design of Omniverse Native Interfaces.

Thread Safety

All methods in this interface are thread safe.

Subclassed by omni::core::Inherits< omni::core::IObject, OMNI_TYPE_ID(“omni.audio.ICaptureStream”)>, omni::core::Inherits< omni::core::IObject, std::integral_constant< uint64_t, carb::fnv1aHash(“omni.core.ITypeFactory”)>::value >, omni::core::Inherits< omni::core::IObject, OMNI_TYPE_ID(“omni.core.IWeakObjectControlBlock”)>, omni::core::Inherits< omni::core::IObject, OMNI_TYPE_ID(“omni.core.IWeakObject”)>, omni::core::Inherits< omni::core::IObject, std::integral_constant< uint64_t, carb::fnv1aHash(“omni.experimental.job.IAffinityMask”)>::value >, omni::core::Inherits< omni::core::IObject, std::integral_constant< uint64_t, carb::fnv1aHash(“omni.experimental.job.IJobAffinity”)>::value >, omni::core::Inherits< omni::core::IObject, std::integral_constant< uint64_t, carb::fnv1aHash(“omni.experimental.job.IJobWorker”)>::value >, omni::core::Inherits< omni::core::IObject, std::integral_constant< uint64_t, carb::fnv1aHash(“omni.experimental.job.IJob”)>::value >, omni::core::Inherits< omni::core::IObject, OMNI_TYPE_ID(“omni.ext.IExtensionData”)>, omni::core::Inherits< omni::core::IObject, OMNI_TYPE_ID(“omni.ext.IExtensionHooks”)>, omni::core::Inherits< omni::core::IObject, std::integral_constant< uint64_t, carb::fnv1aHash(“omni.log.ILogChannelFilter”)>::value >, omni::core::Inherits< omni::core::IObject, std::integral_constant< uint64_t, carb::fnv1aHash(“omni.log.ILogChannelUpdateConsumer”)>::value >, omni::core::Inherits< omni::core::IObject, std::integral_constant< uint64_t, carb::fnv1aHash(“omni.log.ILogMessageConsumer”)>::value >, omni::core::Inherits< omni::core::IObject, std::integral_constant< uint64_t, carb::fnv1aHash(“omni.log.ILog”)>::value >, omni::core::Inherits< omni::core::IObject, std::integral_constant< uint64_t, carb::fnv1aHash(“omni.platforminfo.ICpuInfo”)>::value >, omni::core::Inherits< omni::core::IObject, std::integral_constant< uint64_t, carb::fnv1aHash(“omni.platforminfo.IMemoryInfo”)>::value >, omni::core::Inherits< omni::core::IObject, std::integral_constant< uint64_t, carb::fnv1aHash(“omni.platforminfo.IOsInfo”)>::value >, omni::core::Inherits< omni::core::IObject, std::integral_constant< uint64_t, carb::fnv1aHash(“omni.str.IReadOnlyCString”)>::value >, omni::core::Inherits< omni::core::IObject, std::integral_constant< uint64_t, carb::fnv1aHash(“omni.structuredlog.IStructuredLogControl”)>::value >, omni::core::Inherits< omni::core::IObject, std::integral_constant< uint64_t, carb::fnv1aHash(“omni.structuredlog.IStructuredLogExtraFields”)>::value >, omni::core::Inherits< omni::core::IObject, std::integral_constant< uint64_t, carb::fnv1aHash(“omni.structuredlog.IStructuredLogFromILog”)>::value >, omni::core::Inherits< omni::core::IObject, std::integral_constant< uint64_t, carb::fnv1aHash(“omni.structuredlog.IStructuredLogSettings”)>::value >, omni::core::Inherits< omni::core::IObject, std::integral_constant< uint64_t, carb::fnv1aHash(“omni.structuredlog.IStructuredLog”)>::value >

Public Functions

inline void *cast(omni::core::TypeId id) noexcept

Returns a pointer to the interface defined by the given type id if this object implements the type id’s interface.

Objects can support multiple interfaces, even interfaces that are in different inheritance chains.

The returned object will have omni::core::IObject::acquire() called on it before it is returned, meaning it is up to the caller to call omni::core::IObject::release() on the returned pointer.

The returned pointer can be safely reinterpret_cast<> to the type id’s C++ class. For example, “omni.windowing.IWindow” can be cast to omni::windowing::IWindow.

Do not directly use this method, rather use a wrapper function like omni::core::cast() or omni::core::ObjectPtr::as().

Thread Safety

This method is thread safe.

inline void acquire() noexcept

Increments the object’s reference count.

Objects may have multiple reference counts (e.g. one per interface implemented). As such, it is important that you call omni::core::IObject::release() on the same pointer from which you called omni::core::IObject::acquire().

Do not directly use this method, rather use omni::core::ObjectPtr, which will manage calling omni::core::IObject::acquire() and omni::core::IObject::release() for you.

Thread Safety

This method is thread safe.

inline void release() noexcept

Decrements the objects reference count.

Most implementations will destroy the object if the reference count reaches 0 (though this is not a requirement).

Objects may have multiple reference counts (e.g. one per interface implemented). As such, it is important that you call omni::core::IObject::release() on the same pointer from which you called omni::core::IObject::acquire().

Do not directly use this method, rather use omni::core::ObjectPtr, which will manage calling omni::core::IObject::acquire() and omni::core::IObject::release() for you.

Thread Safety

This method is thread safe.

Protected Functions

virtual void *cast_abi(TypeId id) noexcept = 0

Returns a pointer to the interface defined by the given type id if this object implements the type id’s interface.

Objects can support multiple interfaces, even interfaces that are in different inheritance chains.

The returned object will have omni::core::IObject::acquire() called on it before it is returned, meaning it is up to the caller to call omni::core::IObject::release() on the returned pointer.

The returned pointer can be safely reinterpret_cast<> to the type id’s C++ class. For example, “omni.windowing.IWindow” can be cast to omni::windowing::IWindow.

Do not directly use this method, rather use a wrapper function like omni::core::cast() or omni::core::ObjectPtr::as().

Thread Safety

This method is thread safe.

virtual void acquire_abi() noexcept = 0

Increments the object’s reference count.

Objects may have multiple reference counts (e.g. one per interface implemented). As such, it is important that you call omni::core::IObject::release() on the same pointer from which you called omni::core::IObject::acquire().

Do not directly use this method, rather use omni::core::ObjectPtr, which will manage calling omni::core::IObject::acquire() and omni::core::IObject::release() for you.

Thread Safety

This method is thread safe.

virtual void release_abi() noexcept = 0

Decrements the objects reference count.

Most implementations will destroy the object if the reference count reaches 0 (though this is not a requirement).

Objects may have multiple reference counts (e.g. one per interface implemented). As such, it is important that you call omni::core::IObject::release() on the same pointer from which you called omni::core::IObject::acquire().

Do not directly use this method, rather use omni::core::ObjectPtr, which will manage calling omni::core::IObject::acquire() and omni::core::IObject::release() for you.

Thread Safety

This method is thread safe.