NVIDIA NvNeural SDK  2022.2
GPU inference framework for NVIDIA Nsight Deep Learning Designer
nvneural::IRuntimeOptionsLayer Class Referenceabstract

IRuntimeOptionsLayer is an optional interface that marks a layer as one that uses runtime options. More...

#include <nvneural/LayerTypes.h>

Inheritance diagram for nvneural::IRuntimeOptionsLayer:
nvneural::IRefObject

Public Member Functions

virtual NeuralResult setRuntimeOptionsHost (IRuntimeOptionsHost *pRuntimeOptionsHost) noexcept=0
 This routine is used to link the runtime options host interface with this layer. More...
 
Runtime option description

These routines allow the querying of the current options for this layer.

The string returned is a JSON string of a single option for this layer. If nullptr is returned, the index is out of bounds, nullptr is never returned if the index is legal.

JSON Definition - other modifiers are not listed here, see runtimeoptionsattributes.

"name" = string : name that identifies this control "text" = string : caption text for this control "type" = string : from runtimeoptionstype "enabled" = optional : true or false : indicates whether the control can be interacted with "visible" = optional : true or false : indicated whether the control is visible

For instance, a "stringList" might look like this (alphabetical, it is not necessary): {"enabled":true,"list":["input_a","input_b","input_c"],"name":"selection","text":"test_selector","type":"stringList","visible":true}

virtual std::size_t runtimeOptionCount () const noexcept=0
 Returns the number of available runtime options. More...
 
virtual const char * runtimeOptionByIndex (size_t index) const noexcept=0
 Returns the JSON object describing a specific runtime option. More...
 
virtual NeuralResult setRuntimeOptionValue (const char *pName, const char *pValue) noexcept=0
 Setting and getting option values. More...
 
virtual const char * getRuntimeOptionValue (const char *pName) const noexcept=0
 Retrieves the current value of a runtime option. More...
 
- 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...
 

Static Public Attributes

static const IRefObject::TypeId typeID = 0x3d7156c756e977aeul
 Interface TypeId for InterfaceOf purposes.
 
- Static Public Attributes inherited from nvneural::IRefObject
static const TypeId typeID = 0x14ecc3f9de638e1dul
 Interface TypeId for InterfaceOf purposes.
 

Additional Inherited Members

- 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.
 
- 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

IRuntimeOptionsLayer is an optional interface that marks a layer as one that uses runtime options.

This interface is typically used with analysis layers.

In this interface, there are 3 major operations. Keep in mind each one uses "options" a little differently. Note that all communications between the host and layer are handled through strings. Below are those 3 major operations.

The first one, denoted by runtimeOptionCount() and runtimeOptionByIndex() define the control wanted. This control isn't a specific control, like a check-box, but more of a "payload" of needs that the host draws on. These interfaces give the host the ability to get this information. It is one JSON definition per "control". For instance, a list of inputs.

The second one, denoted by setRuntimeOptionsHost(), is an interface that the host uses to "register" a IRuntimeOptionsHost. This contains options that can be used to contact the host, for instance, IRuntimeOptionsHost::optionsRefreshed() tells the host that the options for this layer have changed and should be reexamined.

The third one, denoted by setRuntimeOptionValue() and getRuntimeOptionValue(), are used by the host to update and verify option value data defined by the JSON definition. For instance, this could be a float value, as a string, from a control in the UI. All values are returned as strings. Any actions that are necessary because an option value changed are usually handled here.

Member Function Documentation

◆ getRuntimeOptionValue()

virtual const char* nvneural::IRuntimeOptionsLayer::getRuntimeOptionValue ( const char *  pName) const
pure virtualnoexcept

Retrieves the current value of a runtime option.

Parameters
pNameName of option to query (matches a JSON "name" attribute)

◆ runtimeOptionByIndex()

virtual const char* nvneural::IRuntimeOptionsLayer::runtimeOptionByIndex ( size_t  index) const
pure virtualnoexcept

Returns the JSON object describing a specific runtime option.

If no option is available because the index is out of range, you may return nullptr.

Parameters
indexZero-based index less than runtimeOptionCount

◆ runtimeOptionCount()

virtual std::size_t nvneural::IRuntimeOptionsLayer::runtimeOptionCount ( ) const
pure virtualnoexcept

Returns the number of available runtime options.

This number should not change after layer initialization.

◆ setRuntimeOptionsHost()

virtual NeuralResult nvneural::IRuntimeOptionsLayer::setRuntimeOptionsHost ( IRuntimeOptionsHost pRuntimeOptionsHost)
pure virtualnoexcept

This routine is used to link the runtime options host interface with this layer.

See IRuntimeOptionsHost for details. This call replaces any previous association.

Parameters
pRuntimeOptionsHostNew host object to associate with the layer.

◆ setRuntimeOptionValue()

virtual NeuralResult nvneural::IRuntimeOptionsLayer::setRuntimeOptionValue ( const char *  pName,
const char *  pValue 
)
pure virtualnoexcept

Setting and getting option values.

These routines are used to update the options from the host or return the option data from the layer. Results from a failure in the update routine should be checked using the getter. Tries to assign a new value to a runtime option. The layer should perform its own parsing and validation; hosts should re-query the option value using getRuntimeOptionValue if this function fails.

Parameters
pNameName of option to set (matches a JSON "name" attribute)
pValueNew value to assign to the option

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