Compute Graph Framework SDK Reference  5.10
SimpleNode.hpp
Go to the documentation of this file.
1
2//
3// Notice
4// ALL NVIDIA DESIGN SPECIFICATIONS AND CODE ("MATERIALS") ARE PROVIDED "AS IS" NVIDIA MAKES
5// NO REPRESENTATIONS, WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
6// THE MATERIALS, AND EXPRESSLY DISCLAIMS ANY IMPLIED WARRANTIES OF NONINFRINGEMENT,
7// MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
8//
9// NVIDIA CORPORATION & AFFILIATES assumes no responsibility for the consequences of use of such
10// information or for any infringement of patents or other rights of third parties that may
11// result from its use. No license is granted by implication or otherwise under any patent
12// or patent rights of NVIDIA CORPORATION & AFFILIATES. No third party distribution is allowed unless
13// expressly authorized by NVIDIA. Details are subject to change without notice.
14// This code supersedes and replaces all information previously supplied.
15// NVIDIA CORPORATION & AFFILIATES products are not authorized for use as critical
16// components in life support devices or systems without express written approval of
17// NVIDIA CORPORATION & AFFILIATES.
18//
19// SPDX-FileCopyrightText: Copyright (c) 2019-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
20// SPDX-License-Identifier: LicenseRef-NvidiaProprietary
21//
22// NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
23// property and proprietary rights in and to this material, related
24// documentation and any modifications thereto. Any use, reproduction,
25// disclosure or distribution of this material and related documentation
26// without an express license agreement from NVIDIA CORPORATION or
27// its affiliates is strictly prohibited.
28//
30
31#ifndef DW_FRAMEWORK_SIMPLENODE_HPP_
32#define DW_FRAMEWORK_SIMPLENODE_HPP_
33
34#include <dw/core/base/Types.h>
35#include <dwcgf/Exception.hpp>
36#include <dwcgf/Types.hpp>
38#include <dwcgf/pass/Pass.hpp>
39#include <dwcgf/node/Node.hpp>
45
46#include <dw/core/container/VectorFixed.hpp>
47#include <dw/core/container/BaseString.hpp>
48
49#include <functional>
50#include <map>
51
52namespace dw
53{
54namespace framework
55{
56
58{
62};
63
64template <typename NodeT>
66{
68 params.maxInputPortCount = portSize<NodeT, PortDirection::INPUT>();
69 params.maxOutputPortCount = portSize<NodeT, PortDirection::OUTPUT>();
70 params.maxPassCount = passSize<NodeT>();
71 return params;
72}
73
74class SimpleNode : public Node
75{
76public:
77 static constexpr const char* PASS_SETUP_NAME = "SETUP";
78 static constexpr const char* PASS_TEARDOWN_NAME = "TEARDOWN";
79
83 virtual ~SimpleNode();
84
85 dwStatus reset() override
86 {
87 throw ExceptionWithStatus(DW_NOT_IMPLEMENTED, "SimpleNode::reset() not implemented");
88 }
89
91
94 dwStatus setInputChannel(ChannelObject* channel, uint8_t portID) override;
95
97 {
98 throw ExceptionWithStatus(DW_NOT_IMPLEMENTED, "SimpleNode::setInputChannel() not implemented");
99 }
100
102
105 dwStatus setOutputChannel(ChannelObject* channel, uint8_t portID) override;
106
108 dwStatus getInputChannel(const uint8_t portID, ChannelObject*& channel) const override;
109
111 dwStatus getOutputChannel(const uint8_t portID, ChannelObject*& channel) const override;
112
113 dwStatus validate() override
114 {
115 throw ExceptionWithStatus(DW_NOT_IMPLEMENTED, "SimpleNode::validate() not implemented");
116 }
117
119
122 dwStatus validate(const char* direction, const PortCollectionDescriptor& collection, const dw::core::HeapHashMap<size_t, std::shared_ptr<PortBase>>& ports, size_t indexOffset = 0);
123
124 dwStatus run() override;
125 size_t getPassCount() const noexcept override;
126 dwStatus runPass(size_t passIndex) override;
127 dwStatus getPass(Pass** pass, uint8_t index) override;
128 dwStatus getPasses(VectorFixed<Pass*>& passList) override;
129 dwStatus getPasses(VectorFixed<Pass*>& passList, dwProcessorType processorType, dwProcessType processType) override;
130
131 dwStatus setName(const char* name) final;
132 dwStatus getName(const char** name) override;
133
134 dwStatus getErrorSignal(dwGraphErrorSignal*& errorSignal) override;
135 dwStatus getHealthSignal(dwGraphHealthSignal*& healthSignals, bool updateFromModule = false) override;
136
137 template <typename Func, typename PortList>
138 void iteratePorts(PortList& portList, Func func)
139 {
140 for (auto elem : portList)
141 {
142 func(elem);
143 }
144 }
145
146 template <typename Func>
148 {
149 iteratePorts(m_inputPorts, [&func, this](decltype(m_inputPorts)::TElement& elem) {
150 if (auto managedPort = dynamic_cast<ManagedPortInputBase*>(elem.second.get()))
151 {
152 func(*managedPort);
153 }
154 else
155 {
156 const char* nodeName = nullptr;
157 this->getName(&nodeName);
158 throw ExceptionWithStatus(DW_BAD_CAST, "SimpleNode: ports are wrong class, node ", nodeName);
159 }
160 });
161 }
162
163 template <typename Func>
165 {
166 iteratePorts(m_outputPorts, [&func, this](decltype(m_outputPorts)::TElement& elem) {
167 if (auto managedPort = dynamic_cast<ManagedPortOutputBase*>(elem.second.get()))
168 {
169 func(*managedPort);
170 }
171 else
172 {
173 const char* nodeName = nullptr;
174 this->getName(&nodeName);
175 throw ExceptionWithStatus(DW_BAD_CAST, "SimpleNode: ports are wrong class node ", nodeName);
176 }
177 });
178 }
179
180 template <typename ModuleHandle_t>
181 dwStatus setModuleHandle(ModuleHandle_t handle, dwContextHandle_t context)
182 {
183 dwModuleHandle_t moduleHandle;
184
185 if (DW_NULL_HANDLE == handle)
186 {
187 return DW_INVALID_ARGUMENT;
188 }
189
190 dwStatus ret = getModuleHandle(&moduleHandle, handle, context);
191 if (DW_SUCCESS != ret)
192 {
193 return ret;
194 }
195
196 return setObjectHandle(moduleHandle);
197 }
198
199 virtual dwStatus setObjectHandle(dwModuleHandle_t handle);
200
202 dwStatus getInputPort(const uint8_t portID, dw::framework::PortBase*& port) const override;
203
205 dwStatus getOutputPort(const uint8_t portID, dw::framework::PortBase*& port) const override;
206
207protected:
208 dwStatus getModuleHandle(dwModuleHandle_t* moduleHandle, void* handle, dwContextHandle_t context);
209
210 virtual std::unique_ptr<Pass> createSetupPass()
211 {
212 throw ExceptionWithStatus(DW_NOT_IMPLEMENTED, "SimpleNode::createSetupPass() not implemented");
213 }
214
215 virtual std::unique_ptr<Pass> createTeardownPass()
216 {
217 throw ExceptionWithStatus(DW_NOT_IMPLEMENTED, "SimpleNode::createTeardownPass() not implemented");
218 }
219
242 template <typename PassFunctionT, typename... Args>
243 std::unique_ptr<PassImpl<PassFunctionT>> make_pass(PassFunctionT func, Args&&... args)
244 {
245 return std::make_unique<PassImpl<PassFunctionT>>(*this, func, std::forward<Args>(args)...);
246 }
247
249
255 template <
256 typename NodeT, size_t PassIndex, typename PassFunctionT>
257 void registerPass(PassFunctionT func, NvMediaDla* dlaEngine = nullptr)
258 {
259 if (!isValidPass<NodeT>(PassIndex))
260 {
261 throw ExceptionWithStatus(DW_INVALID_ARGUMENT, "registerPass called with an invalid pass id: ", PassIndex);
262 }
263 if (m_passList.size() == 0 || m_passList.size() - 1 < PassIndex)
264 {
265 m_passList.resize(PassIndex + 1);
266 m_passOwnershipList.resize(PassIndex + 1);
267 }
268 if (m_passList[PassIndex] != nullptr)
269 {
270 throw ExceptionWithStatus(DW_INVALID_ARGUMENT, "registerPass called with a pass id which has been added before: ", PassIndex);
271 }
272 dwProcessorType processorType = passProcessorType<NodeT, PassIndex>();
273 dwProcessType processType = determineProcessType(processorType);
274 if (dlaEngine == nullptr)
275 {
276 m_passList[PassIndex] = std::make_unique<PassImpl<PassFunctionT>>(*this, func, processorType, processType, -1, -1, -1);
277 }
278 else if (processorType == DW_PROCESSOR_TYPE_DLA_0)
279 {
280 m_passList[PassIndex] = std::make_unique<PassImpl<PassFunctionT>>(*this, func, processorType, processType, -1, -1, -1, dlaEngine);
281 }
282 else
283 {
284 throw ExceptionWithStatus(DW_INVALID_ARGUMENT, "registerPass called with a pass which has dlaEngine but not a DLA pass: ", PassIndex);
285 }
286 m_passOwnershipList[PassIndex] = true;
287 }
288
289public:
292 void addPass(Pass* pass);
293
299
306
314 dwStatus copyModuleHealthSignals(dwHealthSignal& outSignal);
315
325
335
336private:
337 inline dwProcessType determineProcessType(dwProcessorType processorType)
338 {
339 if (processorType == DW_PROCESSOR_TYPE_GPU ||
340 processorType == DW_PROCESSOR_TYPE_DLA_0)
341 {
342 return DW_PROCESS_TYPE_ASYNC;
343 }
344 return DW_PROCESS_TYPE_SYNC;
345 }
346
347 dwStatus updateHealthSignalFromModule();
348
349 VectorFixed<std::unique_ptr<Pass>> m_passList;
350 // tracking ownership is only necessary until addPass(..., Pass* pass) is removed
351 VectorFixed<bool> m_passOwnershipList;
352 FixedString<MAX_NAME_LEN> m_name{};
353 bool m_setupTeardownCreated = false;
354
356 dwGraphErrorSignal m_errorSignal{};
357 dwGraphHealthSignal m_healthSignal{};
358
359 dwModuleHandle_t m_object{};
360 uint32_t m_iterationCount{};
361 uint32_t m_nodePeriod;
362
363public:
365 template <typename TPort, typename... Args>
366 std::unique_ptr<TPort> make_port(Args&&... args)
367 {
368 auto port = std::make_unique<TPort>(std::forward<Args>(args)...);
369 port->setSyncRetriever(std::bind(&SimpleNode::getIterationCount, this));
370 return port;
371 }
372
374
377 template <typename NodeT, size_t PortIndex, typename... Args>
378 void initInputPort(Args&&... args)
379 {
380 static_assert(PortIndex < portSize<NodeT, PortDirection::INPUT>(), "Invalid port index");
381 using DataType = decltype(portType<NodeT, PortDirection::INPUT, PortIndex>());
382 auto port = std::make_shared<ManagedPortInput<DataType>>(std::forward<Args>(args)...);
383 if (m_inputPorts.find(PortIndex) != m_inputPorts.end())
384 {
385 throw ExceptionWithStatus(DW_INVALID_ARGUMENT, "Input port with the following id registered multiple times: ", PortIndex);
386 }
387 m_inputPorts[PortIndex] = port;
388 }
389
391
394 template <typename NodeT, size_t PortIndex, typename... Args>
395 void initInputArrayPort(Args&&... args)
396 {
397 static_assert(PortIndex < portSize<NodeT, PortDirection::INPUT>(), "Invalid port index");
398 using DataType = decltype(portType<NodeT, PortDirection::INPUT, PortIndex>());
399 constexpr size_t descriptor_index = descriptorIndex<NodeT, PortDirection::INPUT, PortIndex>();
400 constexpr size_t arraySize = descriptorPortSize<NodeT, PortDirection::INPUT, descriptor_index>();
401 for (size_t i = 0; i < arraySize; ++i)
402 {
403 auto port = std::make_shared<ManagedPortInput<DataType>>(std::forward<Args>(args)...);
404 if (m_inputPorts.find(PortIndex + i) != m_inputPorts.end())
405 {
406 throw ExceptionWithStatus(DW_INVALID_ARGUMENT, "Input port with the following id registered multiple times: ", PortIndex + i);
407 }
408 m_inputPorts[PortIndex + i] = port;
409 }
410 }
411
413
416 template <typename NodeT, size_t PortIndex, typename... Args>
417 void initOutputPort(Args&&... args)
418 {
419 static_assert(PortIndex - portSize<NodeT, PortDirection::INPUT>() < portSize<NodeT, PortDirection::OUTPUT>(), "Invalid port index");
420 using DataType = decltype(portType<NodeT, PortDirection::OUTPUT, PortIndex>());
421 auto port = std::make_shared<ManagedPortOutput<DataType>>(std::forward<Args>(args)...);
422 if (m_outputPorts.find(PortIndex) != m_outputPorts.end())
423 {
424 throw ExceptionWithStatus(DW_INVALID_ARGUMENT, "Output port with the following id registered multiple times: ", PortIndex);
425 }
426 m_outputPorts[PortIndex] = port;
427 }
428
430
433 template <typename NodeT, size_t PortIndex, typename... Args>
434 void initOutputArrayPort(Args&&... args)
435 {
436 static_assert(PortIndex - portSize<NodeT, PortDirection::INPUT>() < portSize<NodeT, PortDirection::OUTPUT>(), "Invalid port index");
437 using DataType = decltype(portType<NodeT, PortDirection::OUTPUT, PortIndex>());
438 constexpr size_t descriptor_index = descriptorIndex<NodeT, PortDirection::OUTPUT, PortIndex>();
439 constexpr size_t arraySize = descriptorPortSize<NodeT, PortDirection::OUTPUT, descriptor_index>();
440 for (size_t i = 0; i < arraySize; ++i)
441 {
442 auto port = std::make_shared<ManagedPortOutput<DataType>>(std::forward<Args>(args)...);
443 if (m_outputPorts.find(PortIndex + i) != m_outputPorts.end())
444 {
445 throw ExceptionWithStatus(DW_INVALID_ARGUMENT, "Output port with the following id registered multiple times: ", PortIndex + i);
446 }
447 m_outputPorts[PortIndex + i] = port;
448 }
449 }
450
452 template <typename NodeT, size_t PortIndex>
454 {
455 static_assert(PortIndex < portSize<NodeT, PortDirection::INPUT>(), "Invalid port index");
456 constexpr bool isArray = descriptorPortArray<
457 NodeT, PortDirection::INPUT, descriptorIndex<NodeT, PortDirection::INPUT, PortIndex>()>();
458 static_assert(!isArray, "Input port is an array, must pass an array index");
459 if (m_inputPorts.find(PortIndex) == m_inputPorts.end())
460 {
461 throw ExceptionWithStatus(DW_INVALID_ARGUMENT, "Input port with the following id not registered: ", PortIndex);
462 }
463 using DataType = decltype(portType<NodeT, PortDirection::INPUT, PortIndex>());
464 using PointerType = ManagedPortInput<DataType>;
465 using ReturnType = std::shared_ptr<PointerType>;
466 ReturnType port = std::dynamic_pointer_cast<PointerType>(m_inputPorts[PortIndex]);
467 if (!port)
468 {
469 throw ExceptionWithStatus(DW_BAD_CAST, "Failed to cast the following input port to its declared type: ", PortIndex);
470 }
471 return *port;
472 }
473
475 template <typename NodeT, size_t PortIndex>
477 {
478 static_assert(PortIndex < portSize<NodeT, PortDirection::INPUT>(), "Invalid port index");
479 constexpr bool isArray = descriptorPortArray<NodeT, PortDirection::INPUT, descriptorIndex<NodeT, PortDirection::INPUT, PortIndex>()>();
480 static_assert(isArray, "Input port is not an array, must not pass an array index");
481 constexpr size_t arraySize = descriptorPortSize<NodeT, PortDirection::INPUT, descriptorIndex<NodeT, PortDirection::INPUT, PortIndex>()>();
482 if (arrayIndex >= arraySize)
483 {
484 throw ExceptionWithStatus(DW_INVALID_ARGUMENT, "The array index is out of bound: ", arrayIndex);
485 }
486 if (m_inputPorts.find(PortIndex + arrayIndex) == m_inputPorts.end())
487 {
488 throw ExceptionWithStatus(DW_INVALID_ARGUMENT, "Input port with the following id not registered: ", PortIndex + arrayIndex);
489 }
490 using DataType = decltype(portType<NodeT, PortDirection::INPUT, PortIndex>());
491 using PointerType = ManagedPortInput<DataType>;
492 using ReturnType = std::shared_ptr<PointerType>;
493 ReturnType port = std::dynamic_pointer_cast<PointerType>(m_inputPorts[PortIndex + arrayIndex]);
494 if (!port)
495 {
496 throw ExceptionWithStatus(DW_BAD_CAST, "Failed to cast the following input port to its declared type: ", PortIndex + arrayIndex);
497 }
498 return *port;
499 }
500
502 template <typename NodeT, size_t PortIndex>
504 {
505 static_assert(PortIndex - portSize<NodeT, PortDirection::INPUT>() < portSize<NodeT, PortDirection::OUTPUT>(), "Invalid port index");
506 constexpr bool isArray = descriptorPortArray<
507 NodeT, PortDirection::OUTPUT, descriptorIndex<NodeT, PortDirection::OUTPUT, PortIndex>()>();
508 static_assert(!isArray, "Output port is an array, must pass an array index");
509 if (m_outputPorts.find(PortIndex) == m_outputPorts.end())
510 {
511 throw ExceptionWithStatus(DW_INVALID_ARGUMENT, "Output port with the following id not registered: ", PortIndex);
512 }
513 using DataType = decltype(portType<NodeT, PortDirection::OUTPUT, PortIndex>());
514 using PointerType = ManagedPortOutput<DataType>;
515 using ReturnType = std::shared_ptr<PointerType>;
516 ReturnType port = std::dynamic_pointer_cast<PointerType>(m_outputPorts[PortIndex]);
517 if (!port)
518 {
519 throw ExceptionWithStatus(DW_BAD_CAST, "Failed to cast the following output port to its declared type: ", PortIndex);
520 }
521 return *port;
522 }
523
525 template <typename NodeT, size_t PortIndex>
527 {
528 static_assert(PortIndex - portSize<NodeT, PortDirection::INPUT>() < portSize<NodeT, PortDirection::OUTPUT>(), "Invalid port index");
529 constexpr bool isArray = descriptorPortArray<NodeT, PortDirection::OUTPUT, descriptorIndex<NodeT, PortDirection::OUTPUT, PortIndex>()>();
530 static_assert(isArray, "Output port is not an array, must not pass an array index");
531 constexpr size_t arraySize = descriptorPortSize<NodeT, PortDirection::OUTPUT, descriptorIndex<NodeT, PortDirection::OUTPUT, PortIndex>()>();
532 if (arrayIndex >= arraySize)
533 {
534 throw ExceptionWithStatus(DW_INVALID_ARGUMENT, "The array index is out of bound: ", arrayIndex);
535 }
536 if (m_outputPorts.find(PortIndex + arrayIndex) == m_outputPorts.end())
537 {
538 throw ExceptionWithStatus(DW_INVALID_ARGUMENT, "Output port with the following id not registered: ", PortIndex + arrayIndex);
539 }
540 using DataType = decltype(portType<NodeT, PortDirection::OUTPUT, PortIndex>());
541 using PointerType = ManagedPortOutput<DataType>;
542 using ReturnType = std::shared_ptr<PointerType>;
543 ReturnType port = std::dynamic_pointer_cast<PointerType>(m_outputPorts[PortIndex + arrayIndex]);
544 if (!port)
545 {
546 throw ExceptionWithStatus(DW_BAD_CAST, "Failed to cast the following output port to its declared type: ", PortIndex + arrayIndex);
547 }
548 return *port;
549 }
550
552
556 dwStatus setup();
557
559
563 dwStatus teardown();
564
566
570 void resetPorts() override;
571
576 dwStatus setIterationCount(uint32_t iterationCount) override;
577
582 dwStatus setNodePeriod(uint32_t period) override;
583
584 const dw::core::HeapHashMap<size_t, std::shared_ptr<PortBase>>& getRegisteredInputPorts() const
585 {
586 return m_inputPorts;
587 }
588
589 const dw::core::HeapHashMap<size_t, std::shared_ptr<PortBase>>& getRegisteredOutputPorts() const
590 {
591 return m_outputPorts;
592 }
593
594 uint32_t getIterationCount() const;
595 uint32_t getNodePeriod() const;
600 dwStatus setState(const char* state) override
601 {
602 static_cast<void>(state);
603 return DW_SUCCESS;
604 }
605
606protected:
607 dw::core::HeapHashMap<size_t, std::shared_ptr<PortBase>> m_inputPorts;
608 dw::core::HeapHashMap<size_t, std::shared_ptr<PortBase>> m_outputPorts;
609
610 std::atomic<bool> m_asyncResetFlag{false};
611};
612
614{
615public:
616 static constexpr char LOG_TAG[] = "SimpleSensorNode";
617
618 dwStatus start() override
619 {
620 throw ExceptionWithStatus(DW_NOT_IMPLEMENTED, "SimpleSensorNode::start() not implemented");
621 }
622
623 dwStatus stop() override
624 {
625 throw ExceptionWithStatus(DW_NOT_IMPLEMENTED, "SimpleSensorNode::stop() not implemented");
626 }
627
628 dwStatus isVirtual(bool*) override
629 {
630 throw ExceptionWithStatus(DW_NOT_IMPLEMENTED, "SimpleSensorNode::isVirtual() not implemented");
631 }
632
634 {
635 throw ExceptionWithStatus(DW_NOT_IMPLEMENTED, "SimpleSensorNode::setDataEventReadCallback() not implemented");
636 }
637
639 {
640 throw ExceptionWithStatus(DW_NOT_IMPLEMENTED, "SimpleSensorNode::setDataEventWriteCallback() not implemented");
641 }
642};
643
646{
647public:
650};
651
652} // namespace framework
653} // namespace dw
654
655#endif // DW_FRAMEWORK_SIMPLENODE_HPP_
Basic error signal that gets reported only when there is an error.
Basic health signal that describes the health status of the graph.
dw::core::Function< bool(DataEvent &)> DataEventReadCallback
Definition: Node.hpp:353
dw::core::Function< void(DataEvent)> DataEventWriteCallback
Definition: Node.hpp:362
static constexpr uint32_t MAX_PORT_COUNT
Definition: Node.hpp:70
static constexpr uint32_t MAX_PASS_COUNT
Definition: Node.hpp:72
Pass is a runnable describes the metadata of a pass.
Definition: Pass.hpp:49
ManagedPortOutput< decltype(portType< NodeT, PortDirection::OUTPUT, PortIndex >())> & getOutputPort(size_t arrayIndex)
Get one specific ManagedPortOutput from a previously initialized output array port.
Definition: SimpleNode.hpp:526
dwStatus getInputChannel(const uint8_t portID, ChannelObject *&channel) const override
Gets the input channel associated with the input port.
dwStatus reset() override
Definition: SimpleNode.hpp:85
void iterateManagedInputPorts(Func func)
Definition: SimpleNode.hpp:147
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::SimpleNodeT::validate.
dwStatus setNodePeriod(uint32_t period) override
dwStatus validate() override
Definition: SimpleNode.hpp:113
dwStatus getErrorSignal(dwGraphErrorSignal *&errorSignal) override
static constexpr const char * PASS_TEARDOWN_NAME
Definition: SimpleNode.hpp:78
dwStatus setInputChannel(ChannelObject *, uint8_t, dwSerializationType) override
Definition: SimpleNode.hpp:96
void initInputPort(Args &&... args)
Initialize a ManagedPortInput which will be owned by the base class and can be retrieved using getInp...
Definition: SimpleNode.hpp:378
dwStatus updateHealthSignal(const dwGraphHealthSignal &signal)
Adds the provided Health Signal to the Health Signal Array. If the array is full, the new signal will...
dw::core::HeapHashMap< size_t, std::shared_ptr< PortBase > > m_inputPorts
Definition: SimpleNode.hpp:607
const dw::core::HeapHashMap< size_t, std::shared_ptr< PortBase > > & getRegisteredInputPorts() const
Definition: SimpleNode.hpp:584
dwStatus copyModuleHealthSignals(dwHealthSignal &outSignal)
Copy health signals from the module over to the node and stores in outSignal.
uint32_t getNodePeriod() const
void initInputArrayPort(Args &&... args)
Initialize an array of ManagedPortInput which will be owned by the base class and can be retrieved us...
Definition: SimpleNode.hpp:395
void registerPass(PassFunctionT func, NvMediaDla *dlaEngine=nullptr)
Register a pass function with the node base class.
Definition: SimpleNode.hpp:257
SimpleNode(NodeAllocationParams params)
Constructor which tailors the preallocated size of the internal collections for ports and passes to t...
dwStatus setInputChannel(ChannelObject *channel, uint8_t portID) override
Associate an input port with a channel instances.
size_t getPassCount() const noexcept override
dwStatus getPass(Pass **pass, uint8_t index) override
dwStatus setName(const char *name) final
dwStatus getOutputChannel(const uint8_t portID, ChannelObject *&channel) const override
Gets the output channel associated with the output port.
uint32_t getIterationCount() const
dwStatus reportCurrentErrorSignal(dwGraphErrorSignal &signal) override
A function that allows user override to update error signal It is automatically called by dwFramework...
dwStatus setModuleHandle(ModuleHandle_t handle, dwContextHandle_t context)
Definition: SimpleNode.hpp:181
dw::core::HeapHashMap< size_t, std::shared_ptr< PortBase > > m_outputPorts
Definition: SimpleNode.hpp:608
virtual std::unique_ptr< Pass > createTeardownPass()
Definition: SimpleNode.hpp:215
const dw::core::HeapHashMap< size_t, std::shared_ptr< PortBase > > & getRegisteredOutputPorts() const
Definition: SimpleNode.hpp:589
void iterateManagedOutputPorts(Func func)
Definition: SimpleNode.hpp:164
void addPass(Pass *pass)
dwStatus run() override
void resetPorts() override
Default implementation to reset ports managed by the base class.
dwStatus setState(const char *state) override
Definition: SimpleNode.hpp:600
dwStatus getName(const char **name) override
virtual std::unique_ptr< Pass > createSetupPass()
Definition: SimpleNode.hpp:210
dwStatus runPass(size_t passIndex) override
std::unique_ptr< TPort > make_port(Args &&... args)
Definition: SimpleNode.hpp:366
std::unique_ptr< PassImpl< PassFunctionT > > make_pass(PassFunctionT func, Args &&... args)
Definition: SimpleNode.hpp:243
dwStatus getHealthSignal(dwGraphHealthSignal *&healthSignals, bool updateFromModule=false) override
dwStatus reportCurrentHealthSignal(dwGraphHealthSignal &signal) override
A function that allows user override to update health signal It is automatically called by dwFramewor...
dwStatus clearHealthSignal()
Clears the current Health Signals from the Health Signal Array.
dwStatus getPasses(VectorFixed< Pass * > &passList) override
dwStatus getModuleHandle(dwModuleHandle_t *moduleHandle, void *handle, dwContextHandle_t context)
dwStatus setup()
Default implementation of the setup pass.
ManagedPortInput< decltype(portType< NodeT, PortDirection::INPUT, PortIndex >())> & getInputPort()
Get a previously initialized non-array ManagedPortInput.
Definition: SimpleNode.hpp:453
void initOutputPort(Args &&... args)
Initialize a ManagedPortOutput which will be owned by the base class and can be retrieved using getOu...
Definition: SimpleNode.hpp:417
void iteratePorts(PortList &portList, Func func)
Definition: SimpleNode.hpp:138
dwStatus getInputPort(const uint8_t portID, dw::framework::PortBase *&port) const override
Gets the input port associated with the input port Id.
dwStatus getOutputPort(const uint8_t portID, dw::framework::PortBase *&port) const override
Gets the output port associated with the output port Id.
virtual dwStatus setObjectHandle(dwModuleHandle_t handle)
ManagedPortInput< decltype(portType< NodeT, PortDirection::INPUT, PortIndex >())> & getInputPort(size_t arrayIndex)
Get one specific ManagedPortInput from a previously initialized input array port.
Definition: SimpleNode.hpp:476
static constexpr const char * PASS_SETUP_NAME
Definition: SimpleNode.hpp:77
dwStatus teardown()
Default implementation of the teardown pass.
dwStatus setIterationCount(uint32_t iterationCount) override
dwStatus setOutputChannel(ChannelObject *channel, uint8_t portID) override
Associate an output port with a channel instances.
std::atomic< bool > m_asyncResetFlag
Definition: SimpleNode.hpp:610
void initOutputArrayPort(Args &&... args)
Initialize an array of ManagedPortOutput which will be owned by the base class and can be retrieved u...
Definition: SimpleNode.hpp:434
ManagedPortOutput< decltype(portType< NodeT, PortDirection::OUTPUT, PortIndex >())> & getOutputPort()
Get a previously initialized non-array ManagedPortOutput.
Definition: SimpleNode.hpp:503
SimpleProcessNode(NodeAllocationParams params)
dwStatus isVirtual(bool *) override
Definition: SimpleNode.hpp:628
dwStatus setDataEventWriteCallback(DataEventWriteCallback) override
Definition: SimpleNode.hpp:638
static constexpr char LOG_TAG[]
Definition: SimpleNode.hpp:616
dwStatus setDataEventReadCallback(DataEventReadCallback) override
Definition: SimpleNode.hpp:633
constexpr bool descriptorPortArray()
constexpr size_t passIndex(dw::core::StringView identifier)
Get the the pass index for a pass identified by name.
NodeAllocationParams createAllocationParams()
Definition: SimpleNode.hpp:65
dwSerializationType
Definition: Types.hpp:42
Definition: Buffer.hpp:40