• <xmp id="om0om">
  • <table id="om0om"><noscript id="om0om"></noscript></table>
  • Compute Graph Framework SDK Reference  5.14
    All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
    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-2023 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 <dwshared/dwfoundation/dw/core/container/BaseString.hpp>
    47#include <dwshared/dwfoundation/dw/core/container/HashContainer.hpp>
    48#include <dwshared/dwfoundation/dw/core/container/VectorFixed.hpp>
    49#include <dwshared/dwfoundation/dw/core/language/Function.hpp>
    50
    51#include <memory>
    52
    53namespace dw
    54{
    55namespace framework
    56{
    57
    59{
    60public:
    63 size_t maxInputPortCount_,
    64 size_t maxOutputPortCount_,
    65 size_t maxPassCount_)
    66 : maxInputPortCount(maxInputPortCount_)
    67 , maxOutputPortCount(maxOutputPortCount_)
    68 , maxPassCount(maxPassCount_)
    69 {
    70 }
    73 size_t maxPassCount{};
    74};
    75
    76template <typename NodeT>
    77// coverity[autosar_cpp14_a2_10_5_violation] FP: nvbugs/3907242
    79{
    81 portSize<NodeT, PortDirection::INPUT>(),
    82 portSize<NodeT, PortDirection::OUTPUT>(),
    83 passSize<NodeT>()};
    84 return params;
    85}
    86
    87class SimpleNode : public Node
    88{
    89public:
    92
    93 dwStatus reset() override
    94 {
    95 throw ExceptionWithStatus(DW_NOT_IMPLEMENTED, "SimpleNode::reset() not implemented");
    96 }
    97
    99
    102 dwStatus setInputChannel(ChannelObject* channel, uint8_t portID) override;
    103
    105
    108 dwStatus setOutputChannel(ChannelObject* channel, uint8_t portID) override;
    109
    111 dwStatus getInputChannel(const uint8_t portID, ChannelObject*& channel) const override;
    112
    114 dwStatus getOutputChannel(const uint8_t portID, ChannelObject*& channel) const override;
    115
    116 dwStatus validate() override
    117 {
    118 throw ExceptionWithStatus(DW_NOT_IMPLEMENTED, "SimpleNode::validate() not implemented");
    119 }
    120
    122
    125 dwStatus validate(const char* direction, const PortCollectionDescriptor& collection, dw::core::Function<bool(size_t)> isPortBound);
    126
    127 dwStatus run() override;
    128 size_t getPassCount() const noexcept override;
    129 dwStatus runPass(size_t passIndex) override;
    130 dwStatus getPass(Pass** pass, uint8_t index) override;
    131 // coverity[autosar_cpp14_a2_10_5_violation]
    132 dwStatus getPasses(VectorFixed<Pass*>& passList) override;
    133 // coverity[autosar_cpp14_a2_10_5_violation]
    134 dwStatus getPasses(VectorFixed<Pass*>& passList, dwProcessorType processorType) override;
    135
    136 dwStatus setName(const char* name) final;
    137 dwStatus getName(const char** name) override;
    138
    139 dwStatus collectErrorSignals(dwGraphErrorSignal*& errorSignal, bool updateFromModule = true) override;
    140 dwStatus getModuleErrorSignal(dwErrorSignal& errorSignal) override;
    141 dwStatus getNodeErrorSignal(dwGraphErrorSignal& errorSignal) override;
    142 dwStatus collectHealthSignals(dwGraphHealthSignal*& healthSignal, bool updateFromModule = false) override;
    143 dwStatus getModuleHealthSignal(dwHealthSignal& healthSignal) override;
    144 dwStatus getNodeHealthSignal(dwGraphHealthSignal& healthSignal) override;
    145 dwStatus clearErrorSignal() override;
    146 dwStatus clearHealthSignal() override;
    147 dwStatus addToErrorSignal(uint32_t error, dwTime_t timestamp = 0UL) override;
    148 dwStatus addToHealthSignal(uint32_t error, dwTime_t timestamp = 0UL) override;
    149
    150 template <typename Func, typename PortList>
    151 void iteratePorts(PortList& portList, Func func)
    152 {
    153 for (auto& elem : portList)
    154 {
    155 func(elem);
    156 }
    157 }
    158
    159 template <typename Func>
    161 {
    162 iteratePorts(m_inputPorts, [&func, this](decltype(m_inputPorts)::TElement& elem) {
    163 if (elem.second.get() == nullptr)
    164 {
    165 const char* nodeName{nullptr};
    166 this->getName(&nodeName);
    167 throw ExceptionWithStatus(DW_NOT_INITIALIZED, "SimpleNode: input port not initialized, node ", nodeName, ", port id ", elem.first);
    168 }
    169 func(*elem.second);
    170 });
    171 }
    172
    173 template <typename Func>
    175 {
    176 iteratePorts(m_outputPorts, [&func, this](decltype(m_outputPorts)::TElement& elem) {
    177 if (elem.second.get() == nullptr)
    178 {
    179 const char* nodeName{nullptr};
    180 this->getName(&nodeName);
    181 throw ExceptionWithStatus(DW_NOT_INITIALIZED, "SimpleNode: output port not initialized, node ", nodeName, ", port id ", elem.first);
    182 }
    183 func(*elem.second);
    184 });
    185 }
    186
    187 template <typename ModuleHandle_t>
    188 dwStatus setModuleHandle(ModuleHandle_t handle, dwContextHandle_t context)
    189 {
    190 dwModuleHandle_t moduleHandle;
    191
    192 if (DW_NULL_HANDLE == handle)
    193 {
    194 return DW_INVALID_ARGUMENT;
    195 }
    196
    197 dwStatus ret{getModuleHandle(&moduleHandle, handle, context)};
    198 if (DW_SUCCESS != ret)
    199 {
    200 return ret;
    201 }
    202
    203 return setObjectHandle(moduleHandle);
    204 }
    205
    206 virtual dwStatus setObjectHandle(dwModuleHandle_t handle);
    207
    209 dwStatus getInputPort(const uint8_t portID, dw::framework::PortBase*& port) const override;
    210
    212 dwStatus getOutputPort(const uint8_t portID, dw::framework::PortBase*& port) const override;
    213
    214protected:
    215 dwStatus getModuleHandle(dwModuleHandle_t* moduleHandle, void* handle, dwContextHandle_t context);
    216
    218
    224 template <
    225 typename NodeT, size_t PassIndex, typename PassFunctionT>
    226 void registerPass(PassFunctionT func, std::initializer_list<std::pair<dwStatus, uint32_t>> const& returnMapping = {})
    227 {
    228 // coverity[autosar_cpp14_a5_1_1_violation] FP: nvbugs/3364868
    229 if (!isValidPass<NodeT>(PassIndex))
    230 {
    231 throw ExceptionWithStatus(DW_INVALID_ARGUMENT, "registerPass called with an invalid pass id: ", PassIndex);
    232 }
    233 // coverity[autosar_cpp14_a5_1_1_violation] RFD Accepted: TID-2056
    234 if (m_passList.size() == 0U || m_passList.size() - 1U < PassIndex)
    235 {
    236 // coverity[autosar_cpp14_a5_1_1_violation] RFD Accepted: TID-2056
    237 m_passList.resize(PassIndex + 1U);
    238 }
    239 // coverity[autosar_cpp14_a5_1_1_violation] FP: nvbugs/3364868
    240 if (m_passList[PassIndex] != nullptr)
    241 {
    242 throw ExceptionWithStatus(DW_INVALID_ARGUMENT, "registerPass called with a pass id which has been added before: ", PassIndex);
    243 }
    244 dwProcessorType processorType{passProcessorType<NodeT, PassIndex>()};
    245 // coverity[autosar_cpp14_a5_1_1_violation] FP: nvbugs/3364868
    246 m_passList[PassIndex] = std::make_unique<PassImpl<PassFunctionT>>(*this, passName<NodeT, PassIndex>(), func, processorType, returnMapping);
    247 }
    248
    250
    253 template <
    254 typename NodeT, size_t PassIndex, typename PassFunctionT>
    255 void registerPass(PassFunctionT func, cudaStream_t const cudaStream, std::initializer_list<std::pair<dwStatus, uint32_t>> const& returnMapping = {})
    256 {
    257 static_assert(passProcessorType<NodeT, PassIndex>() == DW_PROCESSOR_TYPE_GPU, "The processor type of a pass with a cuda stream must be GPU");
    258 registerPass<NodeT, PassIndex>(func, returnMapping);
    259 m_passList[PassIndex]->m_cudaStream = cudaStream;
    260 }
    261
    262public:
    269
    279
    289
    290protected:
    292 {
    293 return m_healthSignal;
    294 }
    295
    296private:
    297 VectorFixed<std::unique_ptr<Pass>> m_passList;
    298 FixedString<MAX_NAME_LEN> m_name;
    299 bool m_setupTeardownCreated;
    300
    302 dwGraphErrorSignal m_errorSignal;
    303 dwGraphHealthSignal m_healthSignal;
    304
    305 dwModuleHandle_t m_object;
    306 uint32_t m_iterationCount{};
    307 uint32_t m_nodePeriod{};
    308
    309public:
    311
    314 template <typename NodeT, size_t PortIndex, typename... Args>
    315 void initInputPort(Args&&... args)
    316 {
    317 static_assert(PortIndex < portSize<NodeT, PortDirection::INPUT>(), "Invalid port index");
    318 using DataType = decltype(portType<NodeT, PortDirection::INPUT, PortIndex>());
    319 auto port = std::make_shared<ManagedPortInput<DataType>>(portName<NodeT, PortDirection::INPUT, PortIndex>(), std::forward<Args>(args)...);
    320 if (m_inputPorts.find(PortIndex) != m_inputPorts.end())
    321 {
    322 throw ExceptionWithStatus(DW_INVALID_ARGUMENT, "Input port with the following id registered multiple times: ", PortIndex);
    323 }
    324 m_inputPorts[PortIndex] = port;
    325 }
    326
    328
    334 template <typename NodeT, size_t PortIndex, typename... Args>
    335 void initInputArrayPorts(Args&&... args)
    336 {
    337 static_assert(PortIndex < portSize<NodeT, PortDirection::INPUT>(), "Invalid port index");
    338 constexpr size_t arraySize = descriptorPortSize<NodeT, PortDirection::INPUT, descriptorIndex<NodeT, PortDirection::INPUT, PortIndex>()>();
    339 for (size_t i = 0; i < arraySize; ++i)
    340 {
    341 initInputArrayPort<NodeT, PortIndex>(i, std::forward<Args>(args)...);
    342 }
    343 }
    344
    346
    351 template <typename NodeT, size_t PortIndex, typename... Args>
    352 void initInputArrayPort(size_t arrayIndex, Args&&... args)
    353 {
    354 static_assert(PortIndex < portSize<NodeT, PortDirection::INPUT>(), "Invalid port index");
    355 using DataType = decltype(portType<NodeT, PortDirection::INPUT, PortIndex>());
    356 if (arrayIndex >= descriptorPortSize<NodeT, PortDirection::INPUT, descriptorIndex<NodeT, PortDirection::INPUT, PortIndex>()>())
    357 {
    358 throw ExceptionWithStatus(DW_INVALID_ARGUMENT, "Invalid array index ", arrayIndex, " for array input port ", PortIndex);
    359 }
    360 auto port = std::make_shared<ManagedPortInput<DataType>>(portName<NodeT, PortDirection::INPUT, PortIndex>(), std::forward<Args>(args)...);
    361 if (m_inputPorts.find(PortIndex + arrayIndex) != m_inputPorts.end())
    362 {
    363 throw ExceptionWithStatus(DW_INVALID_ARGUMENT, "Input port with the following id registered multiple times: ", PortIndex + arrayIndex);
    364 }
    365 m_inputPorts[PortIndex + arrayIndex] = port;
    366 }
    367
    369
    372 template <typename NodeT, size_t PortIndex, typename... Args>
    373 void initOutputPort(Args&&... args)
    374 {
    375 static_assert(PortIndex - portSize<NodeT, PortDirection::INPUT>() < portSize<NodeT, PortDirection::OUTPUT>(), "Invalid port index");
    376 using DataType = decltype(portType<NodeT, PortDirection::OUTPUT, PortIndex>());
    377 std::shared_ptr<ManagedPortOutput<DataType>> port{std::make_shared<ManagedPortOutput<DataType>>(portName<NodeT, PortDirection::OUTPUT, PortIndex>(), std::forward<Args>(args)...)};
    378 if (m_outputPorts.find(PortIndex) != m_outputPorts.end())
    379 {
    380 throw ExceptionWithStatus(DW_INVALID_ARGUMENT, "Output port with the following id registered multiple times: ", PortIndex);
    381 }
    382 m_outputPorts[PortIndex] = port;
    383 }
    384
    386
    392 template <typename NodeT, size_t PortIndex, typename... Args>
    393 void initOutputArrayPorts(Args&&... args)
    394 {
    395 static_assert(PortIndex - portSize<NodeT, PortDirection::INPUT>() < portSize<NodeT, PortDirection::OUTPUT>(), "Invalid port index");
    396 constexpr size_t arraySize{descriptorPortSize<NodeT, PortDirection::OUTPUT, descriptorIndex<NodeT, PortDirection::OUTPUT, PortIndex>()>()};
    397 for (size_t i{0U}; i < arraySize; ++i)
    398 {
    399 initOutputArrayPort<NodeT, PortIndex>(i, std::forward<Args>(args)...);
    400 }
    401 }
    402
    404
    409 template <typename NodeT, size_t PortIndex, typename... Args>
    410 void initOutputArrayPort(size_t arrayIndex, Args&&... args)
    411 {
    412 static_assert(PortIndex - portSize<NodeT, PortDirection::INPUT>() < portSize<NodeT, PortDirection::OUTPUT>(), "Invalid port index");
    413 using DataType = decltype(portType<NodeT, PortDirection::OUTPUT, PortIndex>());
    414 if (arrayIndex >= descriptorPortSize<NodeT, PortDirection::OUTPUT, descriptorIndex<NodeT, PortDirection::OUTPUT, PortIndex>()>())
    415 {
    416 throw ExceptionWithStatus(DW_INVALID_ARGUMENT, "Invalid array index ", arrayIndex, " for array output port ", PortIndex);
    417 }
    418 std::shared_ptr<ManagedPortOutput<DataType>> port{std::make_shared<ManagedPortOutput<DataType>>(portName<NodeT, PortDirection::OUTPUT, PortIndex>(), std::forward<Args>(args)...)};
    419 if (m_outputPorts.find(PortIndex + arrayIndex) != m_outputPorts.end())
    420 {
    421 throw ExceptionWithStatus(DW_INVALID_ARGUMENT, "Output port with the following id registered multiple times: ", PortIndex + arrayIndex);
    422 }
    423 m_outputPorts[PortIndex + arrayIndex] = port;
    424 }
    425
    427 template <typename NodeT, size_t PortIndex>
    429 {
    430 static_assert(PortIndex < portSize<NodeT, PortDirection::INPUT>(), "Invalid port index");
    431 constexpr bool isArray = descriptorPortArray<
    432 NodeT, PortDirection::INPUT, descriptorIndex<NodeT, PortDirection::INPUT, PortIndex>()>();
    433 static_assert(!isArray, "Input port is an array, must pass an array index");
    434 if (m_inputPorts.find(PortIndex) == m_inputPorts.end())
    435 {
    436 throw ExceptionWithStatus(DW_INVALID_ARGUMENT, "Input port with the following id not registered: ", PortIndex);
    437 }
    438 using DataType = decltype(portType<NodeT, PortDirection::INPUT, PortIndex>());
    439 using PointerType = ManagedPortInput<DataType>;
    440 using ReturnType = std::shared_ptr<PointerType>;
    441 ReturnType port = std::dynamic_pointer_cast<PointerType>(m_inputPorts[PortIndex]);
    442 if (!port)
    443 {
    444 throw ExceptionWithStatus(DW_BAD_CAST, "Failed to cast the following input port to its declared type: ", PortIndex);
    445 }
    446 return *port;
    447 }
    448
    450 template <typename NodeT, size_t PortIndex>
    452 {
    453 static_assert(PortIndex < portSize<NodeT, PortDirection::INPUT>(), "Invalid port index");
    454 constexpr bool isArray = descriptorPortArray<NodeT, PortDirection::INPUT, descriptorIndex<NodeT, PortDirection::INPUT, PortIndex>()>();
    455 static_assert(isArray, "Input port is not an array, must not pass an array index");
    456 constexpr size_t arraySize = descriptorPortSize<NodeT, PortDirection::INPUT, descriptorIndex<NodeT, PortDirection::INPUT, PortIndex>()>();
    457 if (arrayIndex >= arraySize)
    458 {
    459 throw ExceptionWithStatus(DW_INVALID_ARGUMENT, "The array index is out of bound: ", arrayIndex);
    460 }
    461 if (m_inputPorts.find(PortIndex + arrayIndex) == m_inputPorts.end())
    462 {
    463 throw ExceptionWithStatus(DW_INVALID_ARGUMENT, "Input port with the following id not registered: ", PortIndex + arrayIndex);
    464 }
    465 using DataType = decltype(portType<NodeT, PortDirection::INPUT, PortIndex>());
    466 using PointerType = ManagedPortInput<DataType>;
    467 using ReturnType = std::shared_ptr<PointerType>;
    468 ReturnType port = std::dynamic_pointer_cast<PointerType>(m_inputPorts[PortIndex + arrayIndex]);
    469 if (!port)
    470 {
    471 throw ExceptionWithStatus(DW_BAD_CAST, "Failed to cast the following input port to its declared type: ", PortIndex + arrayIndex);
    472 }
    473 return *port;
    474 }
    475
    477 template <typename NodeT, size_t PortIndex>
    479 {
    480 static_assert(PortIndex - portSize<NodeT, PortDirection::INPUT>() < portSize<NodeT, PortDirection::OUTPUT>(), "Invalid port index");
    481 constexpr bool isArray = descriptorPortArray<
    482 NodeT, PortDirection::OUTPUT, descriptorIndex<NodeT, PortDirection::OUTPUT, PortIndex>()>();
    483 static_assert(!isArray, "Output port is an array, must pass an array index");
    484 if (m_outputPorts.find(PortIndex) == m_outputPorts.end())
    485 {
    486 throw ExceptionWithStatus(DW_INVALID_ARGUMENT, "Output port with the following id not registered: ", PortIndex);
    487 }
    488 using DataType = decltype(portType<NodeT, PortDirection::OUTPUT, PortIndex>());
    489 using PointerType = ManagedPortOutput<DataType>;
    490 using ReturnType = std::shared_ptr<PointerType>;
    491 ReturnType port = std::dynamic_pointer_cast<PointerType>(m_outputPorts[PortIndex]);
    492 if (!port)
    493 {
    494 throw ExceptionWithStatus(DW_BAD_CAST, "Failed to cast the following output port to its declared type: ", PortIndex);
    495 }
    496 return *port;
    497 }
    498
    500 template <typename NodeT, size_t PortIndex>
    502 {
    503 static_assert(PortIndex - portSize<NodeT, PortDirection::INPUT>() < portSize<NodeT, PortDirection::OUTPUT>(), "Invalid port index");
    504 constexpr bool isArray = descriptorPortArray<NodeT, PortDirection::OUTPUT, descriptorIndex<NodeT, PortDirection::OUTPUT, PortIndex>()>();
    505 static_assert(isArray, "Output port is not an array, must not pass an array index");
    506 constexpr size_t arraySize = descriptorPortSize<NodeT, PortDirection::OUTPUT, descriptorIndex<NodeT, PortDirection::OUTPUT, PortIndex>()>();
    507 if (arrayIndex >= arraySize)
    508 {
    509 throw ExceptionWithStatus(DW_INVALID_ARGUMENT, "The array index is out of bound: ", arrayIndex);
    510 }
    511 if (m_outputPorts.find(PortIndex + arrayIndex) == m_outputPorts.end())
    512 {
    513 throw ExceptionWithStatus(DW_INVALID_ARGUMENT, "Output port with the following id not registered: ", PortIndex + arrayIndex);
    514 }
    515 using DataType = decltype(portType<NodeT, PortDirection::OUTPUT, PortIndex>());
    516 using PointerType = ManagedPortOutput<DataType>;
    517 using ReturnType = std::shared_ptr<PointerType>;
    518 ReturnType port = std::dynamic_pointer_cast<PointerType>(m_outputPorts[PortIndex + arrayIndex]);
    519 if (!port)
    520 {
    521 throw ExceptionWithStatus(DW_BAD_CAST, "Failed to cast the following output port to its declared type: ", PortIndex + arrayIndex);
    522 }
    523 return *port;
    524 }
    525
    527
    531 dwStatus setup();
    532
    534
    538 dwStatus teardown();
    539
    541
    545 void resetPorts() override;
    546
    551 dwStatus setIterationCount(uint32_t iterationCount) override;
    552
    557 dwStatus setNodePeriod(uint32_t period) override;
    558
    559 const dw::core::HeapHashMap<size_t, std::shared_ptr<ManagedPortInputBase>>& getRegisteredInputPorts() const
    560 {
    561 return m_inputPorts;
    562 }
    563
    564 const dw::core::HeapHashMap<size_t, std::shared_ptr<ManagedPortOutputBase>>& getRegisteredOutputPorts() const
    565 {
    566 return m_outputPorts;
    567 }
    568
    569 uint32_t getIterationCount() const;
    570 uint32_t getNodePeriod() const;
    575 dwStatus setState(const char* state) override
    576 {
    577 static_cast<void>(state);
    578 return DW_SUCCESS;
    579 }
    580
    581protected:
    582 dw::core::HeapHashMap<size_t, std::shared_ptr<ManagedPortInputBase>> m_inputPorts;
    583 dw::core::HeapHashMap<size_t, std::shared_ptr<ManagedPortOutputBase>> m_outputPorts;
    584
    585 std::atomic<bool> m_asyncResetFlag;
    586};
    587
    588// coverity[autosar_cpp14_a0_1_6_violation]
    590{
    591public:
    592 dwStatus start() override
    593 {
    594 throw ExceptionWithStatus(DW_NOT_IMPLEMENTED, "SimpleSensorNode::start() not implemented");
    595 }
    596
    597 dwStatus stop() override
    598 {
    599 throw ExceptionWithStatus(DW_NOT_IMPLEMENTED, "SimpleSensorNode::stop() not implemented");
    600 }
    601
    602 dwStatus isVirtual(bool*) override
    603 {
    604 throw ExceptionWithStatus(DW_NOT_IMPLEMENTED, "SimpleSensorNode::isVirtual() not implemented");
    605 }
    606
    608 {
    609 throw ExceptionWithStatus(DW_NOT_IMPLEMENTED, "SimpleSensorNode::setDataEventReadCallback() not implemented");
    610 }
    611
    613 {
    614 throw ExceptionWithStatus(DW_NOT_IMPLEMENTED, "SimpleSensorNode::setDataEventWriteCallback() not implemented");
    615 }
    616
    617 dwStatus isEnabled(bool&) override
    618 {
    619 throw ExceptionWithStatus(DW_NOT_IMPLEMENTED, "SimpleSensorNode::isEnabled() not implemented");
    620 }
    621};
    622
    623} // namespace framework
    624} // namespace dw
    625
    626#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:402
    dw::core::Function< void(DataEvent)> DataEventWriteCallback
    Definition: Node.hpp:411
    Pass is a runnable describes the metadata of a pass.
    Definition: Pass.hpp:49
    dw::core::HeapHashMap< size_t, std::shared_ptr< ManagedPortInputBase > > m_inputPorts
    Definition: SimpleNode.hpp:582
    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:501
    dwStatus getInputChannel(const uint8_t portID, ChannelObject *&channel) const override
    Gets the input channel associated with the input port.
    void initOutputArrayPorts(Args &&... args)
    Initialize an array of ManagedPortOutput which will be owned by the base class and can be retrieved u...
    Definition: SimpleNode.hpp:393
    dwStatus reset() override
    Definition: SimpleNode.hpp:93
    void iterateManagedInputPorts(Func func)
    Definition: SimpleNode.hpp:160
    dwStatus setNodePeriod(uint32_t period) override
    dwStatus validate() override
    Definition: SimpleNode.hpp:116
    void initInputPort(Args &&... args)
    Initialize a ManagedPortInput which will be owned by the base class and can be retrieved using getInp...
    Definition: SimpleNode.hpp:315
    dwStatus updateHealthSignal(const dwGraphHealthSignal &signal)
    Adds the provided Health Signal to the Health Signal Array. If the array is full, the new signal will...
    uint32_t getNodePeriod() const
    SimpleNode(NodeAllocationParams params)
    Constructor which tailors the preallocated size of the internal collections for ports and passes to t...
    void initOutputArrayPort(size_t arrayIndex, Args &&... args)
    Initialize one ManagedPortOutput of an array which will be owned by the base class and can be retriev...
    Definition: SimpleNode.hpp:410
    dwStatus setInputChannel(ChannelObject *channel, uint8_t portID) override
    Associate an input port with a channel instances.
    size_t getPassCount() const noexcept override
    dwStatus clearHealthSignal() override
    dwStatus getPass(Pass **pass, uint8_t index) override
    dwStatus setName(const char *name) final
    const dw::core::HeapHashMap< size_t, std::shared_ptr< ManagedPortOutputBase > > & getRegisteredOutputPorts() const
    Definition: SimpleNode.hpp:564
    dwStatus getOutputChannel(const uint8_t portID, ChannelObject *&channel) const override
    Gets the output channel associated with the output port.
    uint32_t getIterationCount() const
    dwStatus setModuleHandle(ModuleHandle_t handle, dwContextHandle_t context)
    Definition: SimpleNode.hpp:188
    dwStatus updateCurrentErrorSignal(dwGraphErrorSignal &signal) override
    A function that allows user override to update error signal It is automatically called by dwFramework...
    dwStatus addToHealthSignal(uint32_t error, dwTime_t timestamp=0UL) override
    const dw::core::HeapHashMap< size_t, std::shared_ptr< ManagedPortInputBase > > & getRegisteredInputPorts() const
    Definition: SimpleNode.hpp:559
    void iterateManagedOutputPorts(Func func)
    Definition: SimpleNode.hpp:174
    dwStatus addToErrorSignal(uint32_t error, dwTime_t timestamp=0UL) override
    dwStatus run() override
    dwStatus getNodeErrorSignal(dwGraphErrorSignal &errorSignal) override
    void resetPorts() override
    Default implementation to reset ports managed by the base class.
    dwStatus getNodeHealthSignal(dwGraphHealthSignal &healthSignal) override
    dwStatus setState(const char *state) override
    Definition: SimpleNode.hpp:575
    dwStatus getName(const char **name) override
    dwStatus runPass(size_t passIndex) override
    dwStatus collectHealthSignals(dwGraphHealthSignal *&healthSignal, bool updateFromModule=false) override
    void registerPass(PassFunctionT func, cudaStream_t const cudaStream, std::initializer_list< std::pair< dwStatus, uint32_t > > const &returnMapping={})
    Register a GPU pass function and a cuda stream with the node base class.
    Definition: SimpleNode.hpp:255
    void registerPass(PassFunctionT func, std::initializer_list< std::pair< dwStatus, uint32_t > > const &returnMapping={})
    Register a pass function with the node base class.
    Definition: SimpleNode.hpp:226
    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:428
    void initOutputPort(Args &&... args)
    Initialize a ManagedPortOutput which will be owned by the base class and can be retrieved using getOu...
    Definition: SimpleNode.hpp:373
    void iteratePorts(PortList &portList, Func func)
    Definition: SimpleNode.hpp:151
    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.
    void initInputArrayPort(size_t arrayIndex, Args &&... args)
    Initialize one ManagedPortInput of an array which will be owned by the base class and can be retrieve...
    Definition: SimpleNode.hpp:352
    void initInputArrayPorts(Args &&... args)
    Initialize an array of ManagedPortInput which will be owned by the base class and can be retrieved us...
    Definition: SimpleNode.hpp:335
    dwGraphHealthSignal & getHealthSignal()
    Definition: SimpleNode.hpp:291
    virtual dwStatus setObjectHandle(dwModuleHandle_t handle)
    dwStatus updateCurrentHealthSignal(dwGraphHealthSignal &signal) override
    A function that allows user override to update health signal It is automatically called by dwFramewor...
    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:451
    dwStatus teardown()
    Default implementation of the teardown pass.
    dwStatus validate(const char *direction, const PortCollectionDescriptor &collection, dw::core::Function< bool(size_t)> isPortBound)
    Helper function used by dw::framework::SimpleNodeT::validate.
    dwStatus clearErrorSignal() override
    dwStatus setIterationCount(uint32_t iterationCount) override
    dwStatus setOutputChannel(ChannelObject *channel, uint8_t portID) override
    Associate an output port with a channel instances.
    dwStatus getModuleErrorSignal(dwErrorSignal &errorSignal) override
    dwStatus getModuleHealthSignal(dwHealthSignal &healthSignal) override
    std::atomic< bool > m_asyncResetFlag
    Definition: SimpleNode.hpp:585
    dw::core::HeapHashMap< size_t, std::shared_ptr< ManagedPortOutputBase > > m_outputPorts
    Definition: SimpleNode.hpp:583
    dwStatus collectErrorSignals(dwGraphErrorSignal *&errorSignal, bool updateFromModule=true) override
    ManagedPortOutput< decltype(portType< NodeT, PortDirection::OUTPUT, PortIndex >())> & getOutputPort()
    Get a previously initialized non-array ManagedPortOutput.
    Definition: SimpleNode.hpp:478
    dwStatus isVirtual(bool *) override
    Definition: SimpleNode.hpp:602
    dwStatus setDataEventWriteCallback(DataEventWriteCallback) override
    Definition: SimpleNode.hpp:612
    dwStatus isEnabled(bool &) override
    Definition: SimpleNode.hpp:617
    dwStatus setDataEventReadCallback(DataEventReadCallback) override
    Definition: SimpleNode.hpp:607
    constexpr bool descriptorPortArray()
    constexpr size_t descriptorPortSize()
    constexpr size_t passIndex(dw::core::StringView identifier)
    Get the the pass index for a pass identified by name.
    NodeAllocationParams createAllocationParams()
    Definition: SimpleNode.hpp:78
    Definition: Buffer.hpp:40
    NodeAllocationParams(size_t maxInputPortCount_, size_t maxOutputPortCount_, size_t maxPassCount_)
    Definition: SimpleNode.hpp:62
    人人超碰97caoporen国产