|
NVIDIA NvNeural SDK
2021.2
GPU inference framework for NVIDIA Nsight Deep Learning Designer
|
Base class for all objects, similar to COM's IUnknown. More...
#include <nvneural/CoreTypes.h>
Public Types | |
| using | RefCount = std::uint32_t |
| Typedef used to track the number of active references to an object. | |
| using | TypeId = std::uint64_t |
| Every interface must define a unique TypeId. This should be randomized. | |
Public Member Functions | |
| virtual RefCount | addRef () const noexcept=0 |
| Increments the object's reference count. More... | |
| virtual const void * | queryInterface (TypeId interface) const noexcept=0 |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| virtual void * | queryInterface (TypeId interface) noexcept=0 |
| Retrieves a new object interface pointer. More... | |
| virtual RefCount | release () const noexcept=0 |
| Decrements the object's reference count and destroy the object if the reference count reaches zero. More... | |
Static Public Attributes | |
| static const TypeId | typeID = 0x14ecc3f9de638e1dul |
| Interface TypeId for InterfaceOf purposes. | |
Protected Member Functions | |
| virtual | ~IRefObject ()=default |
| A protected destructor prevents accidental stack-allocation of IRefObjects or use with other smart pointer classes like std::unique_ptr. | |
Base class for all objects, similar to COM's IUnknown.
Why self-deleting: The only safe place to delete memory is from the module that allocated it. Modules linking with a static C runtime (or merely a different version of Microsoft's C runtime) will not necessarily use the same heap, and freeing memory inconsistently does lead to heap corruption bugs.
Why custom RTTI: C++ type_info structures are weak symbols on Linux. Loading a shared library with RTLD_LOCAL (needed for self-contained dependencies) breaks type_info equality, making dynamic_cast unreliable across module boundaries.
Major differences from IUnknown:
As a matter of convention (and to work with the RefPtr helper class), all interface classes should have a static const TypeId member named typeID. You should use the InterfaceOf template to retrieve the interface's TypeId instead of accessing the member directly; this allows implementers to define other TypeId values via partial specialization without necessarily declaring the entire interface class.
|
pure virtualnoexcept |
Increments the object's reference count.
Implemented in nvneural::BufferedLogger.
|
pure virtualnoexcept |
Retrieves a new object interface pointer.
| interface | TypeId of the interface to convert to. |
Implemented in nvneural::BufferedLogger.
|
pure virtualnoexcept |
Decrements the object's reference count and destroy the object if the reference count reaches zero.
Implemented in nvneural::BufferedLogger.