31 #ifndef DW_FRAMEWORK_SIMPLENODE_HPP_ 32 #define DW_FRAMEWORK_SIMPLENODE_HPP_ 34 #include <dw/core/base/Types.h> 36 #include <dwcgf/Types.hpp> 46 #include <dw/core/container/VectorFixed.hpp> 47 #include <dw/core/container/BaseString.hpp> 57 class SimpleProcessNode;
58 class SimpleSensorNode;
67 template <
typename NodeT>
80 static constexpr
const char* PASS_SETUP_NAME =
"SETUP";
81 static constexpr
const char* PASS_TEARDOWN_NAME =
"TEARDOWN";
90 throw Exception(DW_NOT_IMPLEMENTED,
"Not implemented");
97 dwStatus setInputChannel(
ChannelObject* channel, uint8_t portID)
override;
101 throw Exception(DW_NOT_IMPLEMENTED,
"Not implemented");
108 dwStatus setOutputChannel(
ChannelObject* channel, uint8_t portID)
override;
112 throw Exception(DW_NOT_IMPLEMENTED,
"Not implemented");
119 dwStatus validate(
const char* direction,
const PortCollectionDescriptor& collection,
const dw::core::HeapHashMap<
size_t, std::shared_ptr<PortBase>>& ports,
size_t indexOffset = 0);
121 dwStatus run()
override;
122 size_t getPassCount()
const noexcept
override;
123 dwStatus runPassByID(uint8_t passID)
override;
124 dwStatus runPass(
size_t passIndex)
override;
125 dwStatus
getPasses(VectorFixed<Pass*>& passList)
override;
126 dwStatus
getPasses(VectorFixed<Pass*>& passList, dwProcessorType processorType, dwProcessType processType)
override;
128 dwStatus setName(
const char* name)
final;
129 dwStatus getName(
const char** name)
override;
133 template <
typename Func,
typename PortList>
136 for (
auto elem : portList)
142 template <
typename Func>
145 iteratePorts(m_inputPorts, [&func,
this](decltype(m_inputPorts)::TElement& elem) {
146 if (
auto managedPort = dynamic_cast<ManagedPortInputBase*>(elem.second.get()))
152 const char* nodeName =
nullptr;
153 this->getName(&nodeName);
154 throw Exception(DW_BAD_CAST,
"SimpleNode: ports are wrong class, node ", nodeName);
159 template <
typename Func>
162 iteratePorts(m_outputPorts, [&func,
this](decltype(m_outputPorts)::TElement& elem) {
163 if (
auto managedPort = dynamic_cast<ManagedPortOutputBase*>(elem.second.get()))
169 const char* nodeName =
nullptr;
170 this->getName(&nodeName);
171 throw Exception(DW_BAD_CAST,
"SimpleNode: ports are wrong class node ", nodeName);
176 template <
typename ModuleHandle_t>
179 dwModuleHandle_t moduleHandle;
181 if (DW_NULL_HANDLE == handle)
183 return DW_INVALID_ARGUMENT;
186 dwStatus ret = getModuleHandle(&moduleHandle, handle, context);
187 if (DW_SUCCESS != ret)
192 return setObjectHandle(moduleHandle);
195 virtual dwStatus setObjectHandle(dwModuleHandle_t handle);
198 dwStatus getModuleHandle(dwModuleHandle_t* moduleHandle,
void* handle, dwContextHandle_t context);
202 throw Exception(DW_NOT_IMPLEMENTED,
"Not implemented");
207 throw Exception(DW_NOT_IMPLEMENTED,
"Not implemented");
232 template <
typename PassFunctionT,
typename... Args>
233 std::unique_ptr<PassImpl<PassFunctionT>>
make_pass(PassFunctionT func, Args&&... args)
235 return make_pass_with_node(
this, func, std::forward<Args>(args)...);
243 typename NodeT,
size_t PassIndex,
typename PassFunctionT>
246 registerPassWithNode<NodeT, PassIndex>(
this, func, dlaEngine);
254 template <
typename PassFunctionT,
typename... Args>
257 return std::make_unique<PassImpl<PassFunctionT>>(node, func, std::forward<Args>(args)...);
267 typename NodeT,
size_t PassIndex,
typename PassFunctionT>
270 if (!isValidPass<NodeT>(PassIndex))
272 throw Exception(DW_INVALID_ARGUMENT,
"registerPassWithNode called with an invalid pass id: ", PassIndex);
274 if (m_passList.size() == 0 || m_passList.size() - 1 < PassIndex)
276 m_passList.resize(PassIndex + 1);
277 m_passOwnershipList.resize(PassIndex + 1);
279 if (m_passList[PassIndex] !=
nullptr)
281 throw Exception(DW_INVALID_ARGUMENT,
"registerPassWithNode called with a pass id which has been added before: ", PassIndex);
283 dwProcessorType processorType = passProcessorType<NodeT, PassIndex>();
284 dwProcessType processType = determineProcessType(processorType);
285 if (dlaEngine ==
nullptr)
287 m_passList[PassIndex] = std::make_unique<PassImpl<PassFunctionT>>(node, func, processorType, processType, -1, -1, -1);
289 else if (processorType == DW_PROCESSOR_TYPE_DLA_0)
291 m_passList[PassIndex] = std::make_unique<PassImpl<PassFunctionT>>(node, func, processorType, processType, -1, -1, -1, dlaEngine);
295 throw Exception(DW_INVALID_ARGUMENT,
"registerPassWithNode called with a pass which has dlaEngine but not a DLA pass: ", PassIndex);
297 m_passOwnershipList[PassIndex] =
true;
301 void addPass(std::function<std::unique_ptr<Pass>(
void)> createSetup, std::function<std::unique_ptr<Pass>(
void)> createTeardown,
Pass* pass);
308 dwStatus clearHealthSignals();
318 inline dwProcessType determineProcessType(dwProcessorType processorType)
320 if (processorType == DW_PROCESSOR_TYPE_GPU ||
321 processorType == DW_PROCESSOR_TYPE_DLA_0)
323 return DW_PROCESS_TYPE_ASYNC;
325 return DW_PROCESS_TYPE_SYNC;
328 VectorFixed<std::unique_ptr<Pass>> m_passList;
330 VectorFixed<bool> m_passOwnershipList;
331 FixedString<MAX_NAME_LEN> m_name{};
332 bool m_setupTeardownCreated =
false;
340 dwModuleHandle_t m_object{};
341 uint32_t m_iterationCount{};
345 template <
typename TPort,
typename... Args>
348 auto port = std::make_unique<TPort>(std::forward<Args>(args)...);
357 template <
typename NodeT,
size_t PortIndex,
typename... Args>
360 using DataType = decltype(portType<NodeT, PortDirection::INPUT, PortIndex>());
361 auto port = std::make_shared<ManagedPortInput<DataType>>(std::forward<Args>(args)...);
362 if (m_inputPorts.find(PortIndex) != m_inputPorts.end())
364 throw Exception(DW_INVALID_ARGUMENT,
"Input port with the following id registered multiple times: ", PortIndex);
366 m_inputPorts[PortIndex] = port;
373 template <
typename NodeT,
size_t PortIndex,
typename... Args>
376 using DataType = decltype(portType<NodeT, PortDirection::INPUT, PortIndex>());
377 constexpr
size_t descriptor_index = descriptorIndex<NodeT, PortDirection::INPUT, PortIndex>();
378 constexpr
size_t arraySize = descriptorPortSize<NodeT, PortDirection::INPUT, descriptor_index>();
379 for (
size_t i = 0; i < arraySize; ++i)
381 auto port = std::make_shared<ManagedPortInput<DataType>>(std::forward<Args>(args)...);
382 if (m_inputPorts.find(PortIndex + i) != m_inputPorts.end())
384 throw Exception(DW_INVALID_ARGUMENT,
"Input port with the following id registered multiple times: ", PortIndex + i);
386 m_inputPorts[PortIndex + i] = port;
394 template <
typename NodeT,
size_t PortIndex,
typename... Args>
397 using DataType = decltype(portType<NodeT, PortDirection::OUTPUT, PortIndex>());
398 auto port = std::make_shared<ManagedPortOutput<DataType>>(std::forward<Args>(args)...);
399 if (m_outputPorts.find(PortIndex) != m_outputPorts.end())
401 throw Exception(DW_INVALID_ARGUMENT,
"Output port with the following id registered multiple times: ", PortIndex);
403 m_outputPorts[PortIndex] = port;
410 template <
typename NodeT,
size_t PortIndex,
typename... Args>
413 using DataType = decltype(portType<NodeT, PortDirection::OUTPUT, PortIndex>());
414 constexpr
size_t descriptor_index = descriptorIndex<NodeT, PortDirection::OUTPUT, PortIndex>();
415 constexpr
size_t arraySize = descriptorPortSize<NodeT, PortDirection::OUTPUT, descriptor_index>();
416 for (
size_t i = 0; i < arraySize; ++i)
418 auto port = std::make_shared<ManagedPortOutput<DataType>>(std::forward<Args>(args)...);
419 if (m_outputPorts.find(PortIndex + i) != m_outputPorts.end())
421 throw Exception(DW_INVALID_ARGUMENT,
"Output port with the following id registered multiple times: ", PortIndex + i);
423 m_outputPorts[PortIndex + i] = port;
428 template <
typename NodeT,
size_t PortIndex>
433 static_assert(!isArray,
"Input port is an array, must pass an array index");
434 if (m_inputPorts.find(PortIndex) == m_inputPorts.end())
436 throw Exception(DW_INVALID_ARGUMENT,
"Input port with the following id not registered: ", PortIndex);
438 using DataType = decltype(portType<NodeT, PortDirection::INPUT, PortIndex>());
440 using ReturnType = std::shared_ptr<PointerType>;
441 ReturnType port = std::dynamic_pointer_cast<PointerType>(m_inputPorts[PortIndex]);
444 throw Exception(DW_BAD_CAST,
"Failed to cast the following input port to its declared type: ", PortIndex);
450 template <
typename NodeT,
size_t PortIndex>
453 constexpr
bool isArray = descriptorPortArray<NodeT, PortDirection::INPUT, descriptorIndex<NodeT, PortDirection::INPUT, PortIndex>()>();
454 static_assert(isArray,
"Input port is not an array, must not pass an array index");
455 constexpr
size_t arraySize = descriptorPortSize<NodeT, PortDirection::INPUT, descriptorIndex<NodeT, PortDirection::INPUT, PortIndex>()>();
456 if (arrayIndex >= arraySize)
458 throw Exception(DW_INVALID_ARGUMENT,
"The array index is out of bound: ", arrayIndex);
460 if (m_inputPorts.find(PortIndex + arrayIndex) == m_inputPorts.end())
462 throw Exception(DW_INVALID_ARGUMENT,
"Input port with the following id not registered: ", PortIndex + arrayIndex);
464 using DataType = decltype(portType<NodeT, PortDirection::INPUT, PortIndex>());
466 using ReturnType = std::shared_ptr<PointerType>;
467 ReturnType port = std::dynamic_pointer_cast<PointerType>(m_inputPorts[PortIndex + arrayIndex]);
470 throw Exception(DW_BAD_CAST,
"Failed to cast the following input port to its declared type: ", PortIndex + arrayIndex);
476 template <
typename NodeT,
size_t PortIndex>
481 static_assert(!isArray,
"Output port is an array, must pass an array index");
482 if (m_outputPorts.find(PortIndex) == m_outputPorts.end())
484 throw Exception(DW_INVALID_ARGUMENT,
"Output port with the following id not registered: ", PortIndex);
486 using DataType = decltype(portType<NodeT, PortDirection::OUTPUT, PortIndex>());
488 using ReturnType = std::shared_ptr<PointerType>;
489 ReturnType port = std::dynamic_pointer_cast<PointerType>(m_outputPorts[PortIndex]);
492 throw Exception(DW_BAD_CAST,
"Failed to cast the following output port to its declared type: ", PortIndex);
498 template <
typename NodeT,
size_t PortIndex>
501 constexpr
bool isArray = descriptorPortArray<NodeT, PortDirection::OUTPUT, descriptorIndex<NodeT, PortDirection::OUTPUT, PortIndex>()>();
502 static_assert(isArray,
"Output port is not an array, must not pass an array index");
503 constexpr
size_t arraySize = descriptorPortSize<NodeT, PortDirection::OUTPUT, descriptorIndex<NodeT, PortDirection::OUTPUT, PortIndex>()>();
504 if (arrayIndex >= arraySize)
506 throw Exception(DW_INVALID_ARGUMENT,
"The array index is out of bound: ", arrayIndex);
508 if (m_outputPorts.find(PortIndex + arrayIndex) == m_outputPorts.end())
510 throw Exception(DW_INVALID_ARGUMENT,
"Output port with the following id not registered: ", PortIndex + arrayIndex);
512 using DataType = decltype(portType<NodeT, PortDirection::OUTPUT, PortIndex>());
514 using ReturnType = std::shared_ptr<PointerType>;
515 ReturnType port = std::dynamic_pointer_cast<PointerType>(m_outputPorts[PortIndex + arrayIndex]);
518 throw Exception(DW_BAD_CAST,
"Failed to cast the following output port to its declared type: ", PortIndex + arrayIndex);
548 dwStatus setIterationCount(uint32_t iterationCount)
override;
557 return m_outputPorts;
560 uint32_t getIterationCount()
const;
570 static constexpr
char LOG_TAG[] =
"SimpleSensorNode";
576 dwStatus run()
override;
577 size_t getPassCount() const noexcept override;
578 dwStatus runPassByID(uint8_t passID) override;
579 dwStatus runPass(
size_t passIndex) override;
581 dwStatus
getPasses(VectorFixed<
Pass*>& passList, dwProcessorType processorType, dwProcessType processType) override;
583 dwStatus setName(const
char* name) override;
584 dwStatus getName(const
char** name) override;
588 dwStatus start()
override 590 throw Exception(DW_NOT_IMPLEMENTED,
"Not implemented");
595 throw Exception(DW_NOT_IMPLEMENTED,
"Not implemented");
600 throw Exception(DW_NOT_IMPLEMENTED,
"Not implemented");
605 throw Exception(DW_NOT_IMPLEMENTED,
"Not implemented");
610 throw Exception(DW_NOT_IMPLEMENTED,
"Not implemented");
615 throw Exception(DW_NOT_IMPLEMENTED,
"Not implemented");
618 dwStatus setInputChannel(
ChannelObject* channel, uint8_t portID)
override;
620 dwStatus setInputChannel(
ChannelObject* channel, uint8_t portID, dwSerializationType serialType)
override;
622 dwStatus setOutputChannel(
ChannelObject* channel, uint8_t portID)
override;
626 throw Exception(DW_NOT_IMPLEMENTED,
"Not implemented");
629 dwStatus
validate(
const char* direction,
const PortCollectionDescriptor& collection,
const dw::core::HeapHashMap<
size_t, std::shared_ptr<PortBase>>& ports,
size_t indexOffset = 0)
631 return m_simpleNode->validate(direction, collection, ports, indexOffset);
637 throw Exception(DW_NOT_IMPLEMENTED,
"Not implemented");
642 throw Exception(DW_NOT_IMPLEMENTED,
"Not implemented");
647 return m_simpleNode->setup();
652 return m_simpleNode->teardown();
657 m_simpleNode->resetPorts();
660 template <
typename ModuleHandle_t>
663 return m_simpleNode->template setModuleHandle<>(handle, context);
666 dwStatus setObjectHandle(dwModuleHandle_t handle);
668 template <
typename PassFunctionT,
typename... Args>
669 std::unique_ptr<PassImpl<PassFunctionT>>
make_pass(PassFunctionT func, Args&&... args)
671 return m_simpleNode->make_pass_with_node(
this, func, std::forward<Args>(args)...);
675 typename NodeT,
size_t PassIndex,
typename PassFunctionT>
678 m_simpleNode->registerPassWithNode<NodeT, PassIndex>(
this, func, dlaEngine);
681 void addPass(
Pass* pass);
683 dwStatus clearHealthSignals();
690 std::unique_ptr<SimpleNode> m_simpleNode;
693 template <
typename TPort,
typename... Args>
696 return m_simpleNode->make_port<TPort>(std::forward<Args>(args)...);
699 template <
typename NodeT,
size_t PortIndex,
typename... Args>
702 m_simpleNode->initInputPort<NodeT, PortIndex>(std::forward<Args>(args)...);
705 template <
typename NodeT,
size_t PortIndex,
typename... Args>
708 m_simpleNode->initInputArrayPort<NodeT, PortIndex>(std::forward<Args>(args)...);
711 template <
typename NodeT,
size_t PortIndex,
typename... Args>
714 m_simpleNode->initOutputPort<NodeT, PortIndex>(std::forward<Args>(args)...);
717 template <
typename NodeT,
size_t PortIndex,
typename... Args>
720 m_simpleNode->initOutputArrayPort<NodeT, PortIndex>(std::forward<Args>(args)...);
723 template <
typename NodeT,
size_t PortIndex>
726 return m_simpleNode->getInputPort<NodeT, PortIndex>();
729 template <
typename NodeT,
size_t PortIndex>
732 return m_simpleNode->getInputPort<NodeT, PortIndex>(arrayIndex);
735 template <
typename NodeT,
size_t PortIndex>
738 return m_simpleNode->getOutputPort<NodeT, PortIndex>();
741 template <
typename NodeT,
size_t PortIndex>
744 return m_simpleNode->getOutputPort<NodeT, PortIndex>(arrayIndex);
749 return m_simpleNode->getRegisteredInputPorts();
754 return m_simpleNode->getRegisteredOutputPorts();
759 return m_simpleNode->setIterationCount(iterationCount);
764 return m_simpleNode->getIterationCount();
771 static constexpr
char LOG_TAG[] =
"SimpleProcessNode";
777 dwStatus run()
override;
778 size_t getPassCount() const noexcept override;
779 dwStatus runPassByID(uint8_t passID) override;
780 dwStatus runPass(
size_t passIndex) override;
782 dwStatus
getPasses(VectorFixed<
Pass*>& passList, dwProcessorType processorType, dwProcessType processType) override;
784 dwStatus setName(const
char* name) override;
785 dwStatus getName(const
char** name) override;
789 dwStatus reset()
override 791 throw Exception(DW_NOT_IMPLEMENTED,
"Not implemented");
794 dwStatus setInputChannel(
ChannelObject* channel, uint8_t portID)
override;
796 dwStatus setInputChannel(
ChannelObject* channel, uint8_t portID, dwSerializationType serialType)
override;
798 dwStatus setOutputChannel(
ChannelObject* channel, uint8_t portID)
override;
802 throw Exception(DW_NOT_IMPLEMENTED,
"Not implemented");
805 dwStatus
validate(
const char* direction,
const PortCollectionDescriptor& collection,
const dw::core::HeapHashMap<
size_t, std::shared_ptr<PortBase>>& ports,
size_t indexOffset = 0)
807 return m_simpleNode->validate(direction, collection, ports, indexOffset);
813 throw Exception(DW_NOT_IMPLEMENTED,
"Not implemented");
818 throw Exception(DW_NOT_IMPLEMENTED,
"Not implemented");
823 return m_simpleNode->setup();
828 return m_simpleNode->teardown();
833 m_simpleNode->resetPorts();
836 template <
typename ModuleHandle_t>
839 return m_simpleNode->template setModuleHandle<>(handle, context);
842 dwStatus setObjectHandle(dwModuleHandle_t handle);
844 template <
typename PassFunctionT,
typename... Args>
845 std::unique_ptr<PassImpl<PassFunctionT>>
make_pass(PassFunctionT func, Args&&... args)
847 return m_simpleNode->make_pass_with_node(
this, func, std::forward<Args>(args)...);
851 typename NodeT,
size_t PassIndex,
typename PassFunctionT>
854 m_simpleNode->registerPassWithNode<NodeT, PassIndex>(
this, func, dlaEngine);
857 void addPass(
Pass* pass);
859 dwStatus clearHealthSignals();
866 std::shared_ptr<SimpleNode> m_simpleNode;
869 template <
typename TPort,
typename... Args>
872 return m_simpleNode->make_port<TPort>(std::forward<Args>(args)...);
875 template <
typename NodeT,
size_t PortIndex,
typename... Args>
878 m_simpleNode->initInputPort<NodeT, PortIndex>(std::forward<Args>(args)...);
881 template <
typename NodeT,
size_t PortIndex,
typename... Args>
884 m_simpleNode->initInputArrayPort<NodeT, PortIndex>(std::forward<Args>(args)...);
887 template <
typename NodeT,
size_t PortIndex,
typename... Args>
890 m_simpleNode->initOutputPort<NodeT, PortIndex>(std::forward<Args>(args)...);
893 template <
typename NodeT,
size_t PortIndex,
typename... Args>
896 m_simpleNode->initOutputArrayPort<NodeT, PortIndex>(std::forward<Args>(args)...);
899 template <
typename NodeT,
size_t PortIndex>
902 return m_simpleNode->getInputPort<NodeT, PortIndex>();
905 template <
typename NodeT,
size_t PortIndex>
908 return m_simpleNode->getInputPort<NodeT, PortIndex>(arrayIndex);
911 template <
typename NodeT,
size_t PortIndex>
914 return m_simpleNode->getOutputPort<NodeT, PortIndex>();
917 template <
typename NodeT,
size_t PortIndex>
920 return m_simpleNode->getOutputPort<NodeT, PortIndex>(arrayIndex);
925 return m_simpleNode->getRegisteredInputPorts();
930 return m_simpleNode->getRegisteredOutputPorts();
935 return m_simpleNode->setIterationCount(iterationCount);
940 return m_simpleNode->getIterationCount();
947 #endif // DW_FRAMEWORK_SIMPLENODE_HPP_ dw::core::Function< void(DataEvent)> DataEventWriteCallback
size_t maxOutputPortCount
dwStatus setModuleHandle(ModuleHandle_t handle, dwContextHandle_t context)
uint32_t getIterationCount() const
auto make_port(Args &&... args)
void registerPass(PassFunctionT func, NvMediaDla *dlaEngine=nullptr)
void initOutputArrayPort(Args &&... args)
void initInputArrayPort(Args &&... args)
dwStatus validate(const char *direction, const PortCollectionDescriptor &collection, const dw::core::HeapHashMap< size_t, std::shared_ptr< PortBase >> &ports, size_t indexOffset=0)
ManagedPortInput< decltype(portType< NodeT, PortDirection::INPUT, PortIndex >))> & getInputPort()
Get a previously initialized non-array ManagedPortInput.
dwStatus setDataEventWriteCallback(DataEventWriteCallback) override
Basic health signal that describes the health status of the graph.
virtual std::unique_ptr< Pass > createSetupPass()
static constexpr uint32_t MAX_PORT_COUNT
dwStatus reset() override
void initInputPort(Args &&... args)
Initialize a ManagedPortInput which will be owned by the base class and can be retrieved using getInp...
const dw::core::HeapHashMap< size_t, std::shared_ptr< PortBase > > & getRegisteredOutputPorts() const
void initOutputPort(Args &&... args)
virtual std::unique_ptr< Pass > createTeardownPass()
const dw::core::HeapHashMap< size_t, std::shared_ptr< PortBase > > & getRegisteredInputPorts() const
dwStatus isVirtual(bool *) override
void initInputArrayPort(Args &&... args)
constexpr bool descriptorPortArray()
void iteratePorts(PortList &portList, Func func)
void initInputPort(Args &&... args)
void registerPassWithNode(Node *node, PassFunctionT func, NvMediaDla *dlaEngine=nullptr)
Register a pass function with the node base class.
dwStatus validate() override
ManagedPortInput< decltype(portType< NodeT, PortDirection::INPUT, PortIndex >))> & getInputPort(size_t arrayIndex)
Get one specific ManagedPortInput from a previously initialized input array port. ...
dw::core::HeapHashMap< size_t, std::shared_ptr< PortBase > > m_inputPorts
const dw::core::HeapHashMap< size_t, std::shared_ptr< PortBase > > & getRegisteredOutputPorts() const
dwStatus validate() override
const dw::core::HeapHashMap< size_t, std::shared_ptr< PortBase > > & getRegisteredInputPorts() const
void initInputPort(Args &&... args)
dwStatus validate() override
void iterateManagedOutputPorts(Func func)
dwStatus setInputChannel(ChannelObject *, uint8_t, dwSerializationType) override
dwStatus setDataEventReadCallback(DataEventReadCallback) override
void initOutputArrayPort(Args &&... args)
Initialize an array of ManagedPortOutput which will be owned by the base class and can be retrieved u...
dwStatus setIterationCount(uint32_t iterationCount) override
std::unique_ptr< PassImpl< PassFunctionT > > make_pass(PassFunctionT func, Args &&... args)
Simple helper to create a pass with any function implementing operator()
dwStatus validate(const char *direction, const PortCollectionDescriptor &collection, const dw::core::HeapHashMap< size_t, std::shared_ptr< PortBase >> &ports, size_t indexOffset=0)
NodeAllocationParams createAllocationParams()
virtual std::unique_ptr< Pass > createTeardownPass()
virtual std::unique_ptr< Pass > createSetupPass()
std::unique_ptr< PassImpl< PassFunctionT > > make_pass(PassFunctionT func, Args &&... args)
Pass is a runnable describes the metadata of a pass.
static constexpr uint32_t MAX_PASS_COUNT
void initInputArrayPort(Args &&... args)
Initialize an array of ManagedPortInput which will be owned by the base class and can be retrieved us...
std::atomic< bool > m_asyncResetFlag
auto & getInputPort(size_t arrayIndex)
dwStatus setIterationCount(uint32_t iterationCount) override
void initOutputArrayPort(Args &&... args)
std::unique_ptr< TPort > make_port(Args &&... args)
uint32_t getIterationCount() const
std::unique_ptr< PassImpl< PassFunctionT > > make_pass_with_node(Node *node, PassFunctionT func, Args &&... args)
Register a pass function with the node base class.
uint32_t getIterationCount() const
virtual std::unique_ptr< Pass > createSetupPass()
dwStatus setModuleHandle(ModuleHandle_t handle, dwContextHandle_t context)
dw::core::Function< bool(DataEvent &)> DataEventReadCallback
virtual std::unique_ptr< Pass > createTeardownPass()
void initOutputPort(Args &&... args)
auto & getOutputPort(size_t arrayIndex)
constexpr size_t passIndex(dw::core::StringView identifier)
Get the the pass index for a pass identified by name.
void registerPass(PassFunctionT func, NvMediaDla *dlaEngine=nullptr)
Register a pass function with the node base class.
void registerPass(PassFunctionT func, NvMediaDla *dlaEngine=nullptr)
void iterateManagedInputPorts(Func func)
const PassCollectionDescriptor & getPasses(const dw::core::StringView &className)
std::atomic< bool > m_asyncResetFlag
Derived ManagedPortOutput<T> provides type-specific interfaces for accessing buffers.
dwStatus reset() override
std::unique_ptr< PassImpl< PassFunctionT > > make_pass(PassFunctionT func, Args &&... args)
auto & getInputPort(size_t arrayIndex)
ManagedPortOutput< decltype(portType< NodeT, PortDirection::OUTPUT, PortIndex >))> & getOutputPort()
Get a previously initialized non-array ManagedPortOutput.
void initOutputPort(Args &&... args)
Initialize a ManagedPortOutput which will be owned by the base class and can be retrieved using getOu...
const dw::core::HeapHashMap< size_t, std::shared_ptr< PortBase > > & getRegisteredOutputPorts() const
auto & getOutputPort(size_t arrayIndex)
dwStatus setModuleHandle(ModuleHandle_t handle, dwContextHandle_t context)
ManagedPortOutput< decltype(portType< NodeT, PortDirection::OUTPUT, PortIndex >))> & getOutputPort(size_t arrayIndex)
Get one specific ManagedPortOutput from a previously initialized output array port.
const dw::core::HeapHashMap< size_t, std::shared_ptr< PortBase > > & getRegisteredInputPorts() const
auto make_port(Args &&... args)
dw::core::HeapHashMap< size_t, std::shared_ptr< PortBase > > m_outputPorts