NVIDIA NvNeural SDK  2021.2
GPU inference framework for NVIDIA Nsight Deep Learning Designer
nvneural::IResourceAggregator Class Referenceabstract

Key-value store for creating IResourceDictionary objects. More...

#include <nvneural/CodeGenTypes.h>

Inheritance diagram for nvneural::IResourceAggregator:
nvneural::IRefObject

Public Types

using ResourceId = IResourceDictionary::ResourceId
 Unique identifier for a resource. More...
 
- Public Types inherited from nvneural::IRefObject
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 NeuralResult addResource (ResourceId *pResourceIdOut, const void *pBuffer, std::uint32_t bufferBytes) noexcept=0
 Adds a resource to the dictionary, avoiding duplicates. More...
 
virtual NeuralResult finalize () noexcept=0
 Finalizes the resource collection, allowing for compression and serialization to take place.
 
virtual const void * resourceBufferByIndex (std::size_t resourceIndex) const noexcept=0
 Returns a pointer to the Nth finalized resource buffer in the object. More...
 
virtual std::size_t resourceBufferSizeByIndex (std::size_t resourceIndex) const noexcept=0
 Returns the byte count associated with the Nth finalized resource buffer in the object. More...
 
virtual ResourceId resourceIdByIndex (std::size_t resourceIndex) const noexcept=0
 Returns the Nth resource ID in the object. More...
 
virtual std::size_t resourceIdCount () const noexcept=0
 Returns the number of finalized resources in the object.
 
- Public Member Functions inherited from nvneural::IRefObject
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...
 

Additional Inherited Members

- Static Public Attributes inherited from nvneural::IRefObject
static const TypeId typeID = 0x14ecc3f9de638e1dul
 Interface TypeId for InterfaceOf purposes.
 
- Protected Member Functions inherited from nvneural::IRefObject
virtual ~IRefObject ()=default
 A protected destructor prevents accidental stack-allocation of IRefObjects or use with other smart pointer classes like std::unique_ptr.
 

Detailed Description

Key-value store for creating IResourceDictionary objects.

Each IResourceAggregator implementation is typically paired with a specific version of IResourceDictionary; generated code that loads from a dictionary typically does not need to know how the dictionary was compressed.

Member Typedef Documentation

◆ ResourceId

Unique identifier for a resource.

Depending on the specific dictionary implementation, multiple IDs may point to the same binary data, but each ID will reference only one resource in the object.

Member Function Documentation

◆ addResource()

virtual NeuralResult nvneural::IResourceAggregator::addResource ( ResourceId pResourceIdOut,
const void *  pBuffer,
std::uint32_t  bufferBytes 
)
pure virtualnoexcept

Adds a resource to the dictionary, avoiding duplicates.

It is an error to add resources after finalize has been called.

Parameters
pResourceIdOutVariable receiving the stored resource ID
pBufferPointer to the resource
bufferBytesSize of the buffer in bytes

◆ resourceBufferByIndex()

virtual const void* nvneural::IResourceAggregator::resourceBufferByIndex ( std::size_t  resourceIndex) const
pure virtualnoexcept

Returns a pointer to the Nth finalized resource buffer in the object.

Parameters
resourceIndexIndex value in the range [0, resourceIdCount())

◆ resourceBufferSizeByIndex()

virtual std::size_t nvneural::IResourceAggregator::resourceBufferSizeByIndex ( std::size_t  resourceIndex) const
pure virtualnoexcept

Returns the byte count associated with the Nth finalized resource buffer in the object.

Parameters
resourceIndexIndex value in the range [0, resourceIdCount())

◆ resourceIdByIndex()

virtual ResourceId nvneural::IResourceAggregator::resourceIdByIndex ( std::size_t  resourceIndex) const
pure virtualnoexcept

Returns the Nth resource ID in the object.

Parameters
resourceIndexIndex value in the range [0, resourceIdCount())

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