Compute Graph Framework SDK Reference  5.10
Channel.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) 2018-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_CHANNEL_HPP_
32#define DW_FRAMEWORK_CHANNEL_HPP_
33
34#include "ChannelParameters.hpp"
35#include "IChannelPacket.hpp"
36
37#include <dw/core/context/Context.h>
38#include <dw/core/language/Function.hpp>
39#include <dw/core/container/BaseString.hpp>
40
41#include <memory>
42#include <mutex>
43#include <string>
44
45namespace dw
46{
47namespace framework
48{
49
51static constexpr dwTime_t CHN_WAIT_TIMEOUT_US = 50'000'000;
52
57{
58public:
59 virtual ~ChannelObject() = default;
60
65 {
66 public:
75 virtual void getSyncObjs(dw::core::span<NvSciSyncObj>& syncObjs) = 0;
76 };
77
81 class SyncWaiter : public SyncClient
82 {
83 public:
93 virtual void getWaitFences(void* data, dw::core::span<NvSciSyncFence>& waitFences) = 0;
94 };
95
99 class SyncSignaler : public SyncClient
100 {
101 public:
110 virtual void setSignalFences(void* data, dw::core::span<const NvSciSyncFence> postFences) = 0;
111 };
112
117 {
118 public:
120
122
132 virtual dwStatus wait(dwTime_t timeout) = 0;
133
134 using OnDataReady = dw::core::Function<void()>;
135
141 virtual void setOnDataReady(void* opaque, OnDataReady onDataReady) = 0;
142 };
143
147 class Producer : public PacketPool
148 {
149 public:
156 virtual dwStatus get(GenericData* data) = 0;
166 virtual dwStatus send(void* data) = 0;
167
176 virtual dwStatus release(void* data) = 0;
177 };
178
182 class Consumer : public PacketPool
183 {
184 public:
195 virtual dwStatus recv(GenericData* data) = 0;
206 virtual dwStatus release(void* data) = 0;
207 };
208
220
231
236 virtual bool hasClients() const = 0;
237
242 virtual bool isConnected() const = 0;
243
254 virtual dwStatus connect(dwTime_t timeout) = 0;
255
259 virtual const ChannelParams& getParams() const = 0;
260
266 virtual void disconnectEndpoint(const char* nvsciipcEndpoint) = 0;
267
273 virtual void connectEndpoint(const char* nvsciipcEndpoint) = 0;
274};
275
276} // namespace framework
277} // namespace dw
278
279#endif // DW_FRAMEWORK_CHANNEL_HPP_
virtual dwStatus recv(GenericData *data)=0
virtual dwStatus release(void *data)=0
virtual dwStatus wait(dwTime_t timeout)=0
virtual void setOnDataReady(void *opaque, OnDataReady onDataReady)=0
dw::core::Function< void()> OnDataReady
Definition: Channel.hpp:134
virtual dwStatus get(GenericData *data)=0
virtual dwStatus release(void *data)=0
virtual dwStatus send(void *data)=0
virtual void getSyncObjs(dw::core::span< NvSciSyncObj > &syncObjs)=0
virtual void setSignalFences(void *data, dw::core::span< const NvSciSyncFence > postFences)=0
virtual void getWaitFences(void *data, dw::core::span< NvSciSyncFence > &waitFences)=0
virtual Producer * getProducer(GenericDataReference ref)=0
virtual const ChannelParams & getParams() const =0
virtual ~ChannelObject()=default
virtual Consumer * getConsumer(GenericDataReference ref)=0
virtual bool isConnected() const =0
virtual dwStatus connect(dwTime_t timeout)=0
virtual void connectEndpoint(const char *nvsciipcEndpoint)=0
virtual void disconnectEndpoint(const char *nvsciipcEndpoint)=0
virtual bool hasClients() const =0
static constexpr dwTime_t CHN_WAIT_TIMEOUT_US
Definition: Channel.hpp:51
Definition: Buffer.hpp:40