Compute Graph Framework SDK Reference
5.4.5418 Release
For Test and Development only

dw::framework::SimpleNode Class Reference

Detailed Description

Definition at line 77 of file SimpleNode.hpp.

Inheritance diagram for dw::framework::SimpleNode:
dw::framework::Node

Public Types

using Name_t = FixedString< MAX_NAME_LEN >
 

Public Member Functions

dwStatus addHealthSignal (const dwGraphHealthSignal &signal)
 
void addPass (std::function< std::unique_ptr< Pass >(void)> createSetup, std::function< std::unique_ptr< Pass >(void)> createTeardown, Pass *pass)
 
dwStatus clearHealthSignals ()
 
dwStatus getHealthSignals (dwGraphHealthSignalArray *&healthSignals) override
 
template<typename NodeT , size_t PortIndex>
ManagedPortInput< decltype(portType< NodeT, PortDirection::INPUT, PortIndex >))> & getInputPort ()
 Get a previously initialized non-array ManagedPortInput. More...
 
template<typename NodeT , size_t PortIndex>
ManagedPortInput< decltype(portType< NodeT, PortDirection::INPUT, PortIndex >))> & getInputPort (size_t arrayIndex)
 Get one specific ManagedPortInput from a previously initialized input array port. More...
 
uint32_t getIterationCount () const
 
dwStatus getName (const char **name) override
 
template<typename NodeT , size_t PortIndex>
ManagedPortOutput< decltype(portType< NodeT, PortDirection::OUTPUT, PortIndex >))> & getOutputPort ()
 Get a previously initialized non-array ManagedPortOutput. More...
 
template<typename NodeT , size_t PortIndex>
ManagedPortOutput< decltype(portType< NodeT, PortDirection::OUTPUT, PortIndex >))> & getOutputPort (size_t arrayIndex)
 Get one specific ManagedPortOutput from a previously initialized output array port. More...
 
size_t getPassCount () const noexcept override
 
dwStatus getPasses (VectorFixed< Pass *> &passList) override
 
dwStatus getPasses (VectorFixed< Pass *> &passList, dwProcessorType processorType, dwProcessType processType) override
 
const dw::core::HeapHashMap< size_t, std::shared_ptr< PortBase > > & getRegisteredInputPorts () const
 
const dw::core::HeapHashMap< size_t, std::shared_ptr< PortBase > > & getRegisteredOutputPorts () const
 
template<typename NodeT , size_t PortIndex, typename... Args>
void initInputArrayPort (Args &&... args)
 Initialize an array of ManagedPortInput which will be owned by the base class and can be retrieved using getInputPort(size_t). More...
 
template<typename NodeT , size_t PortIndex, typename... Args>
void initInputPort (Args &&... args)
 Initialize a ManagedPortInput which will be owned by the base class and can be retrieved using getInputPort(). More...
 
template<typename NodeT , size_t PortIndex, typename... Args>
void initOutputArrayPort (Args &&... args)
 Initialize an array of ManagedPortOutput which will be owned by the base class and can be retrieved using getOutputPort(size_t). More...
 
template<typename NodeT , size_t PortIndex, typename... Args>
void initOutputPort (Args &&... args)
 Initialize a ManagedPortOutput which will be owned by the base class and can be retrieved using getOutputPort(). More...
 
template<typename Func >
void iterateManagedInputPorts (Func func)
 
template<typename Func >
void iterateManagedOutputPorts (Func func)
 
template<typename Func , typename PortList >
void iteratePorts (PortList &portList, Func func)
 
template<typename PassFunctionT , typename... Args>
std::unique_ptr< PassImpl< PassFunctionT > > make_pass_with_node (Node *node, PassFunctionT func, Args &&... args)
 Register a pass function with the node base class. More...
 
template<typename TPort , typename... Args>
std::unique_ptr< TPort > make_port (Args &&... args)
 
template<typename NodeT , size_t PassIndex, typename PassFunctionT >
void registerPassWithNode (Node *node, PassFunctionT func, NvMediaDla *dlaEngine=nullptr)
 Register a pass function with the node base class. More...
 
dwStatus reset () override
 
void resetPorts ()
 Default implementation to reset ports managed by the base class. More...
 
dwStatus run () override
 
dwStatus runPass (size_t passIndex) override
 
dwStatus runPassByID (uint8_t passID) override
 
dwStatus setInputChannel (ChannelObject *channel, uint8_t portID) override
 Associate an input port with a channel instances. More...
 
dwStatus setInputChannel (ChannelObject *, uint8_t, dwSerializationType) override
 
dwStatus setIterationCount (uint32_t iterationCount) override
 Sets the node's iteration count. More...
 
template<typename ModuleHandle_t >
dwStatus setModuleHandle (ModuleHandle_t handle, dwContextHandle_t context)
 
dwStatus setName (const char *name) final
 
virtual dwStatus setObjectHandle (dwModuleHandle_t handle)
 
dwStatus setOutputChannel (ChannelObject *channel, uint8_t portID) override
 Associate an output port with a channel instances. More...
 
dwStatus setup ()
 Default implementation of the setup pass. More...
 
 SimpleNode ()
 
 SimpleNode (NodeAllocationParams params)
 Constructor which tailors the preallocated size of the internal collections for ports and passes to the need of the concrete node. More...
 
dwStatus teardown ()
 Default implementation of the teardown pass. More...
 
dwStatus validate () override
 
dwStatus validate (const char *direction, const PortCollectionDescriptor &collection, const dw::core::HeapHashMap< size_t, std::shared_ptr< PortBase >> &ports, size_t indexOffset=0)
 Helper function used by dw::framework::SimpleProcessNodeT::validate and dw::framework::SimpleSensorNodeT::validate. More...
 
virtual ~SimpleNode ()
 

Static Public Attributes

static constexpr size_t MAX_NAME_LEN = 128
 
static constexpr uint32_t MAX_PASS_COUNT = 256
 
static constexpr uint32_t MAX_PORT_COUNT = 256
 
static constexpr uint8_t PASS_SETUP = std::numeric_limits<uint8_t>::max() - 1
 
static constexpr const char * PASS_SETUP_NAME = "SETUP"
 
static constexpr uint8_t PASS_TEARDOWN = std::numeric_limits<uint8_t>::max()
 
static constexpr const char * PASS_TEARDOWN_NAME = "TEARDOWN"
 

Protected Member Functions

virtual std::unique_ptr< PasscreateSetupPass ()
 
virtual std::unique_ptr< PasscreateTeardownPass ()
 
dwStatus getModuleHandle (dwModuleHandle_t *moduleHandle, void *handle, dwContextHandle_t context)
 
template<typename PassFunctionT , typename... Args>
std::unique_ptr< PassImpl< PassFunctionT > > make_pass (PassFunctionT func, Args &&... args)
 Simple helper to create a pass with any function implementing operator() More...
 
template<typename NodeT , size_t PassIndex, typename PassFunctionT >
void registerPass (PassFunctionT func, NvMediaDla *dlaEngine=nullptr)
 Register a pass function with the node base class. More...
 

Protected Attributes

dw::core::HeapHashMap< size_t, std::shared_ptr< PortBase > > m_inputPorts
 
dw::core::HeapHashMap< size_t, std::shared_ptr< PortBase > > m_outputPorts
 

Member Typedef Documentation

◆ Name_t

using dw::framework::Node::Name_t = FixedString<MAX_NAME_LEN>
inherited

Definition at line 67 of file Node.hpp.

Constructor & Destructor Documentation

◆ SimpleNode() [1/2]

dw::framework::SimpleNode::SimpleNode ( )

◆ SimpleNode() [2/2]

dw::framework::SimpleNode::SimpleNode ( NodeAllocationParams  params)

Constructor which tailors the preallocated size of the internal collections for ports and passes to the need of the concrete node.

◆ ~SimpleNode()

virtual dw::framework::SimpleNode::~SimpleNode ( )
virtual

Member Function Documentation

◆ addHealthSignal()

dwStatus dw::framework::SimpleNode::addHealthSignal ( const dwGraphHealthSignal signal)

◆ addPass()

void dw::framework::SimpleNode::addPass ( std::function< std::unique_ptr< Pass >(void)>  createSetup,
std::function< std::unique_ptr< Pass >(void)>  createTeardown,
Pass pass 
)

◆ clearHealthSignals()

dwStatus dw::framework::SimpleNode::clearHealthSignals ( )

◆ createSetupPass()

virtual std::unique_ptr<Pass> dw::framework::SimpleNode::createSetupPass ( )
inlineprotectedvirtual

Definition at line 200 of file SimpleNode.hpp.

◆ createTeardownPass()

virtual std::unique_ptr<Pass> dw::framework::SimpleNode::createTeardownPass ( )
inlineprotectedvirtual

Definition at line 205 of file SimpleNode.hpp.

◆ getHealthSignals()

dwStatus dw::framework::SimpleNode::getHealthSignals ( dwGraphHealthSignalArray *&  healthSignals)
overridevirtual

Implements dw::framework::Node.

◆ getInputPort() [1/2]

template<typename NodeT , size_t PortIndex>
ManagedPortInput<decltype(portType<NodeT, PortDirection::INPUT, PortIndex>))>& dw::framework::SimpleNode::getInputPort ( )
inline

Get a previously initialized non-array ManagedPortInput.

Definition at line 429 of file SimpleNode.hpp.

References dw::framework::descriptorPortArray(), and dw::framework::INPUT.

◆ getInputPort() [2/2]

template<typename NodeT , size_t PortIndex>
ManagedPortInput<decltype(portType<NodeT, PortDirection::INPUT, PortIndex>))>& dw::framework::SimpleNode::getInputPort ( size_t  arrayIndex)
inline

Get one specific ManagedPortInput from a previously initialized input array port.

Definition at line 451 of file SimpleNode.hpp.

◆ getIterationCount()

uint32_t dw::framework::SimpleNode::getIterationCount ( ) const

Referenced by make_port().

◆ getModuleHandle()

dwStatus dw::framework::SimpleNode::getModuleHandle ( dwModuleHandle_t *  moduleHandle,
void *  handle,
dwContextHandle_t  context 
)
protected

◆ getName()

dwStatus dw::framework::SimpleNode::getName ( const char **  name)
overridevirtual

Implements dw::framework::Node.

◆ getOutputPort() [1/2]

template<typename NodeT , size_t PortIndex>
ManagedPortOutput<decltype(portType<NodeT, PortDirection::OUTPUT, PortIndex>))>& dw::framework::SimpleNode::getOutputPort ( )
inline

Get a previously initialized non-array ManagedPortOutput.

Definition at line 477 of file SimpleNode.hpp.

References dw::framework::descriptorPortArray(), and dw::framework::OUTPUT.

◆ getOutputPort() [2/2]

template<typename NodeT , size_t PortIndex>
ManagedPortOutput<decltype(portType<NodeT, PortDirection::OUTPUT, PortIndex>))>& dw::framework::SimpleNode::getOutputPort ( size_t  arrayIndex)
inline

Get one specific ManagedPortOutput from a previously initialized output array port.

Definition at line 499 of file SimpleNode.hpp.

◆ getPassCount()

size_t dw::framework::SimpleNode::getPassCount ( ) const
overridevirtualnoexcept

Implements dw::framework::Node.

◆ getPasses() [1/2]

dwStatus dw::framework::SimpleNode::getPasses ( VectorFixed< Pass *> &  passList)
overridevirtual

Implements dw::framework::Node.

◆ getPasses() [2/2]

dwStatus dw::framework::SimpleNode::getPasses ( VectorFixed< Pass *> &  passList,
dwProcessorType  processorType,
dwProcessType  processType 
)
overridevirtual

Implements dw::framework::Node.

◆ getRegisteredInputPorts()

const dw::core::HeapHashMap<size_t, std::shared_ptr<PortBase> >& dw::framework::SimpleNode::getRegisteredInputPorts ( ) const
inline

Definition at line 550 of file SimpleNode.hpp.

◆ getRegisteredOutputPorts()

const dw::core::HeapHashMap<size_t, std::shared_ptr<PortBase> >& dw::framework::SimpleNode::getRegisteredOutputPorts ( ) const
inline

Definition at line 555 of file SimpleNode.hpp.

◆ initInputArrayPort()

template<typename NodeT , size_t PortIndex, typename... Args>
void dw::framework::SimpleNode::initInputArrayPort ( Args &&...  args)
inline

Initialize an array of ManagedPortInput which will be owned by the base class and can be retrieved using getInputPort(size_t).

The macro NODE_INIT_INPUT_ARRAY_PORT can be used for convenience to hide the template parameters of this method.

Definition at line 374 of file SimpleNode.hpp.

◆ initInputPort()

template<typename NodeT , size_t PortIndex, typename... Args>
void dw::framework::SimpleNode::initInputPort ( Args &&...  args)
inline

Initialize a ManagedPortInput which will be owned by the base class and can be retrieved using getInputPort().

The macro NODE_INIT_INPUT_PORT can be used for convenience to hide the template parameters of this method.

Definition at line 358 of file SimpleNode.hpp.

◆ initOutputArrayPort()

template<typename NodeT , size_t PortIndex, typename... Args>
void dw::framework::SimpleNode::initOutputArrayPort ( Args &&...  args)
inline

Initialize an array of ManagedPortOutput which will be owned by the base class and can be retrieved using getOutputPort(size_t).

The macro NODE_INIT_OUTPUT_ARRAY_PORT can be used for convenience to hide the template parameters of this method.

Definition at line 411 of file SimpleNode.hpp.

◆ initOutputPort()

template<typename NodeT , size_t PortIndex, typename... Args>
void dw::framework::SimpleNode::initOutputPort ( Args &&...  args)
inline

Initialize a ManagedPortOutput which will be owned by the base class and can be retrieved using getOutputPort().

The macro NODE_INIT_OUTPUT_PORT can be used for convenience to hide the template parameters of this method.

Definition at line 395 of file SimpleNode.hpp.

◆ iterateManagedInputPorts()

template<typename Func >
void dw::framework::SimpleNode::iterateManagedInputPorts ( Func  func)
inline

Definition at line 143 of file SimpleNode.hpp.

◆ iterateManagedOutputPorts()

template<typename Func >
void dw::framework::SimpleNode::iterateManagedOutputPorts ( Func  func)
inline

Definition at line 160 of file SimpleNode.hpp.

◆ iteratePorts()

template<typename Func , typename PortList >
void dw::framework::SimpleNode::iteratePorts ( PortList &  portList,
Func  func 
)
inline

Definition at line 134 of file SimpleNode.hpp.

◆ make_pass()

template<typename PassFunctionT , typename... Args>
std::unique_ptr<PassImpl<PassFunctionT> > dw::framework::SimpleNode::make_pass ( PassFunctionT  func,
Args &&...  args 
)
inlineprotected

Simple helper to create a pass with any function implementing operator()

Example: class MyNode : public Node { MyNode() { const int32_t someArg = 1;

auto pass1 = make_pass([someArg, this]() { return myPassWithArgs(someArg); }, ...); auto pass2 = make_pass([this]() { return myPassNoArgs(); }, ...); }

private: dwStatus myPassWithArgs(int32_t a); dwStatus myPassNoArgs(); }

Note
cannot use here PassFunctionT&& + std::forward<PassFunctionT>(func) because that makes the captured this pointer by a passed lambda become invalid, see

Definition at line 233 of file SimpleNode.hpp.

◆ make_pass_with_node()

template<typename PassFunctionT , typename... Args>
std::unique_ptr<PassImpl<PassFunctionT> > dw::framework::SimpleNode::make_pass_with_node ( Node node,
PassFunctionT  func,
Args &&...  args 
)
inline

Register a pass function with the node base class.

This method shouldn't be called directly from a concrete node but is only used by SimpleProcessNode::make_pass and SimpleSensorNode::make_pass.

Definition at line 255 of file SimpleNode.hpp.

◆ make_port()

template<typename TPort , typename... Args>
std::unique_ptr<TPort> dw::framework::SimpleNode::make_port ( Args &&...  args)
inline

◆ registerPass()

template<typename NodeT , size_t PassIndex, typename PassFunctionT >
void dw::framework::SimpleNode::registerPass ( PassFunctionT  func,
NvMediaDla *  dlaEngine = nullptr 
)
inlineprotected

Register a pass function with the node base class.

The macro NODE_REGISTER_PASS can be used for convenience to hide the template parameters of this method.

Definition at line 244 of file SimpleNode.hpp.

◆ registerPassWithNode()

template<typename NodeT , size_t PassIndex, typename PassFunctionT >
void dw::framework::SimpleNode::registerPassWithNode ( Node node,
PassFunctionT  func,
NvMediaDla *  dlaEngine = nullptr 
)
inline

Register a pass function with the node base class.

Note that the processorType DLA_0 and DLA_1 will be replaced by DLA when STM support cuDLA and dw deprecated them Issue tracked in AVCGF-569 This method shouldn't be called directly from a concrete node but is only used by SimpleProcessNode::registerPass and SimpleSensorNode::registerPass.

Definition at line 268 of file SimpleNode.hpp.

◆ reset()

dwStatus dw::framework::SimpleNode::reset ( )
inlineoverridevirtual

Implements dw::framework::Node.

Definition at line 88 of file SimpleNode.hpp.

◆ resetPorts()

void dw::framework::SimpleNode::resetPorts ( )

Default implementation to reset ports managed by the base class.

Call ManagedPortInput::reset on all input ports. This method is used by SimpleProcessNodeT::reset and SimpleSensorNodeT::reset.

◆ run()

dwStatus dw::framework::SimpleNode::run ( )
overridevirtual

Implements dw::framework::Node.

◆ runPass()

dwStatus dw::framework::SimpleNode::runPass ( size_t  passIndex)
overridevirtual

Implements dw::framework::Node.

◆ runPassByID()

dwStatus dw::framework::SimpleNode::runPassByID ( uint8_t  passID)
overridevirtual

Implements dw::framework::Node.

◆ setInputChannel() [1/2]

dwStatus dw::framework::SimpleNode::setInputChannel ( ChannelObject channel,
uint8_t  portID 
)
overridevirtual

Associate an input port with a channel instances.

A concrete node shouldn't need to override this method if all input ports are initialized in the constructor using the macros like NODE_INIT_INPUT_PORT.

Implements dw::framework::Node.

◆ setInputChannel() [2/2]

dwStatus dw::framework::SimpleNode::setInputChannel ( ChannelObject ,
uint8_t  ,
dwSerializationType   
)
inlineoverridevirtual

Implements dw::framework::Node.

Definition at line 99 of file SimpleNode.hpp.

◆ setIterationCount()

dwStatus dw::framework::SimpleNode::setIterationCount ( uint32_t  iterationCount)
overridevirtual

Sets the node's iteration count.

The value set can be retrieved with getIterationCount.

Implements dw::framework::Node.

◆ setModuleHandle()

template<typename ModuleHandle_t >
dwStatus dw::framework::SimpleNode::setModuleHandle ( ModuleHandle_t  handle,
dwContextHandle_t  context 
)
inline

Definition at line 177 of file SimpleNode.hpp.

◆ setName()

dwStatus dw::framework::SimpleNode::setName ( const char *  name)
finalvirtual

Implements dw::framework::Node.

◆ setObjectHandle()

virtual dwStatus dw::framework::SimpleNode::setObjectHandle ( dwModuleHandle_t  handle)
virtual

◆ setOutputChannel()

dwStatus dw::framework::SimpleNode::setOutputChannel ( ChannelObject channel,
uint8_t  portID 
)
overridevirtual

Associate an output port with a channel instances.

A concrete node shouldn't need to override this method if all output ports are initialized in the constructor using the macros like NODE_INIT_OUTPUT_PORT.

Implements dw::framework::Node.

◆ setup()

dwStatus dw::framework::SimpleNode::setup ( )

Default implementation of the setup pass.

Check that all ports which are bound to a channel have a buffer available. This method is used by SimpleProcessNodeT::setupImpl and SimpleSensorNodeT::setupImpl.

◆ teardown()

dwStatus dw::framework::SimpleNode::teardown ( )

Default implementation of the teardown pass.

Call ManagedPortInput::release on all input ports. This method is used by SimpleProcessNodeT::teardownImpl and SimpleSensorNodeT::teardownImpl.

◆ validate() [1/2]

dwStatus dw::framework::SimpleNode::validate ( )
inlineoverridevirtual

Implements dw::framework::Node.

Definition at line 110 of file SimpleNode.hpp.

References dw::framework::getPasses(), and dw::framework::passIndex().

◆ validate() [2/2]

dwStatus dw::framework::SimpleNode::validate ( const char *  direction,
const PortCollectionDescriptor collection,
const dw::core::HeapHashMap< size_t, std::shared_ptr< PortBase >> &  ports,
size_t  indexOffset = 0 
)

Helper function used by dw::framework::SimpleProcessNodeT::validate and dw::framework::SimpleSensorNodeT::validate.

A concrete node shouldn't need to override or call this method.

Field Documentation

◆ m_inputPorts

dw::core::HeapHashMap<size_t, std::shared_ptr<PortBase> > dw::framework::SimpleNode::m_inputPorts
protected

Definition at line 563 of file SimpleNode.hpp.

◆ m_outputPorts

dw::core::HeapHashMap<size_t, std::shared_ptr<PortBase> > dw::framework::SimpleNode::m_outputPorts
protected

Definition at line 564 of file SimpleNode.hpp.

◆ MAX_NAME_LEN

constexpr size_t dw::framework::Node::MAX_NAME_LEN = 128
staticinherited

Definition at line 66 of file Node.hpp.

◆ MAX_PASS_COUNT

constexpr uint32_t dw::framework::Node::MAX_PASS_COUNT = 256
staticinherited

Definition at line 71 of file Node.hpp.

◆ MAX_PORT_COUNT

constexpr uint32_t dw::framework::Node::MAX_PORT_COUNT = 256
staticinherited

Definition at line 69 of file Node.hpp.

◆ PASS_SETUP

constexpr uint8_t dw::framework::Node::PASS_SETUP = std::numeric_limits<uint8_t>::max() - 1
staticinherited

Definition at line 72 of file Node.hpp.

◆ PASS_SETUP_NAME

constexpr const char* dw::framework::SimpleNode::PASS_SETUP_NAME = "SETUP"
static

Definition at line 80 of file SimpleNode.hpp.

◆ PASS_TEARDOWN

constexpr uint8_t dw::framework::Node::PASS_TEARDOWN = std::numeric_limits<uint8_t>::max()
staticinherited

Definition at line 73 of file Node.hpp.

◆ PASS_TEARDOWN_NAME

constexpr const char* dw::framework::SimpleNode::PASS_TEARDOWN_NAME = "TEARDOWN"
static

Definition at line 81 of file SimpleNode.hpp.


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