Compute Graph Framework SDK Reference  5.16
Port.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-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_PORT_H_
32#define DW_FRAMEWORK_PORT_H_
33
35#include <dwcgf/Exception.hpp>
36#include <dwshared/dwfoundation/dw/core/container/StringView.hpp>
37#include <dwshared/dwfoundation/dw/core/logger/Logger.hpp>
39
40#include "SyncPortHelper.hpp"
41
42#include <nvscisync.h>
43#include <stdexcept>
44#include <string>
45
46namespace dw
47{
48namespace framework
49{
50
51namespace detail
52{
53
54template <typename T>
55// coverity[autosar_cpp14_a2_10_5_violation] FP: nvbugs/3907242
56T* getBufferTyped(GenericData buffer)
57{
58 MetadataPayload* metadataPacket{extractMetadata(buffer)};
59 T* ptr{metadataPacket->data.template getData<T>()};
60
61 if (nullptr == ptr)
62 {
63 throw ExceptionWithStatus(DW_INVALID_ARGUMENT, "getBufferTyped: type mismatch");
64 }
65 return ptr;
66}
67
68// coverity[autosar_cpp14_a14_1_1_violation]
69template <typename T>
70struct vectorIterable
71{
72 explicit vectorIterable(dw::core::VectorFixed<GenericData> allBuffers)
73 : m_allBuffers(std::move(allBuffers))
74 {
75 }
76
78 // There are no specific requirements on the template type
79 // coverity[autosar_cpp14_a14_1_1_violation]
80 template <class TT>
81 class iterator : public dw::core::VectorFixed<GenericData>::iterator
82 {
83 public:
84 using Base = dw::core::VectorFixed<GenericData>::iterator;
85 // Same naming is used in dwshared, hence keeping the iterator name and its accessors for now
86 // coverity[cert_dcl51_cpp_violation]
87 iterator(Base&& base)
88 : Base(std::move(base))
89 {
90 }
91
92 const Base& baseFromThis() const
93 {
94 return *this;
95 }
96
97 TT* operator*() const
98 {
99 GenericData buffer{*baseFromThis()};
100 return getBufferTyped<TT>(buffer);
101 }
102 };
103
104 // coverity[cert_dcl51_cpp_violation]
105 iterator<T> begin() { return iterator<T>(m_allBuffers.begin()); }
106
107 // coverity[cert_dcl51_cpp_violation]
108 iterator<T> end() { return iterator<T>(m_allBuffers.end()); }
109
110 // coverity[cert_dcl51_cpp_violation]
111 iterator<const T> begin() const { return iterator<const T>(m_allBuffers.begin()); }
112
113 // coverity[cert_dcl51_cpp_violation]
114 iterator<const T> end() const { return iterator<const T>(m_allBuffers.end()); }
115
116private:
117 dw::core::VectorFixed<GenericData> m_allBuffers;
118};
119
120} // namespace detail
121
123enum class PortDirection : uint8_t
124{
125 INPUT = 0,
126 OUTPUT,
127};
128
129// coverity[autosar_cpp14_m3_4_1_violation]
131{
132public:
133 virtual ~PortBase() = default;
134};
135
137class Port : public PortBase
138{
139public:
140 virtual dwStatus bindChannel(ChannelObject* channel) = 0;
141 virtual bool isBound() = 0;
143 {
144 return m_channel;
145 };
146
147protected:
149};
150
152
159template <typename T>
160// coverity[autosar_cpp14_a10_1_1_violation]
161class PortOutput : public SyncPortHelperOutput<T>, public Port
162{
163public:
165 // coverity[autosar_cpp14_a0_1_6_violation]
166 using ApiDataTypeT = T;
169
170 static_assert(std::is_copy_constructible<SpecimenT>::value, "SpecimenT is not copy constructible");
171
172 // coverity[autosar_cpp14_a2_10_5_violation] RFD Pending: TID-2053
173 static constexpr char LOG_TAG[]{"PortOutput"};
174
175private:
176 ChannelObject::Producer* m_channelProducer;
177 SpecimenT m_reference;
178 OnSetSyncAttrs m_waiterAttrs;
179 OnSetSyncAttrs m_signalerAttrs;
180 uint32_t m_sendSeqNum;
181
182public:
183 explicit PortOutput(SpecimenT const& ref)
185 , Port()
186 , m_channelProducer(nullptr)
187 , m_reference(ref)
188 , m_sendSeqNum(0U)
189 {
190 }
191 explicit PortOutput(SpecimenT&& ref)
193 , Port()
194 , m_channelProducer(nullptr)
195 , m_reference(std::move(ref))
196 , m_sendSeqNum(0U)
197 {
198 }
199
200 explicit PortOutput(SpecimenT const& ref,
201 OnSetSyncAttrs signalerAttrs,
202 OnSetSyncAttrs waiterAttrs = {})
204 , Port()
205 , m_channelProducer(nullptr)
206 , m_reference(ref)
207 , m_waiterAttrs(waiterAttrs)
208 , m_signalerAttrs(signalerAttrs)
209 , m_sendSeqNum(0U)
210 {
211 }
212
213 // Channel Bind
214 dwStatus bindChannel(ChannelObject* channel) override
215 {
216 GenericDataReference ref{make_specimen<T>(&m_reference)};
217 return bindChannelWithReference(channel, ref);
218 }
219
221 {
222 return ExceptionGuard::guard([&] {
223 if (isBound())
224 {
225 // TODO(chale): this should be an Exception but applications are currently
226 // doing this. Those applications should be fixed.
227 DW_LOGE << dw::core::StringView{"PortOutput: bindChannel: attempted to bind the same port twice, ignoring this bind!"} << Logger::State::endl;
228 return;
229 }
230 if (nullptr == channel)
231 {
232 throw ExceptionWithStatus(DW_INVALID_ARGUMENT, "PortOutput: bindChannel: expected channel != nullptr");
233 }
234 m_channel = channel;
237 ref.setWaiterAttributes = m_waiterAttrs;
238 ref.setSignalerAttributes = m_signalerAttrs;
239
240 m_channelProducer = channel->getProducer(ref);
241 if (nullptr == m_channelProducer)
242 {
243 throw ExceptionWithStatus(DW_INTERNAL_ERROR, "PortOutput bindChannel: wrong channel implementations returned.");
244 }
245 },
246 dw::core::Logger::Verbosity::DEBUG);
247 }
248
255 {
256 return ExceptionGuard::guard([&] {
257 if (isBound())
258 {
259 // TODO(chale): this should be an Exception but applications are currently
260 // doing this. Those applications should be fixed.
261 DW_LOGE << dw::core::StringView{"PortOutput: bindChannelForPODTypePacket: attempted to bind the same port twice, ignoring this bind!"} << Logger::State::endl;
262 return;
263 }
264 if (nullptr == channel)
265 {
266 throw ExceptionWithStatus(DW_INVALID_ARGUMENT, "PortOutput: bindChannelForPODTypePacket: expected channel != nullptr");
267 }
268 if (ChannelType::SHMEM_LOCAL != channel->getParams().getType())
269 {
270 throw dw::core::ExceptionWithStatus(DW_CALL_NOT_ALLOWED, "PortOutput: bindChannelForPODTypePacket: setting channel to use POD type only allowed for local channels.");
271 }
272
274
277 ref.typeSize = sizeof(T);
278 ref.data = GenericData(static_cast<T*>(nullptr));
279 ref.setWaiterAttributes = m_waiterAttrs;
280 ref.setSignalerAttributes = m_signalerAttrs;
281
282 m_channelProducer = channel->getProducer(ref);
283 if (nullptr == m_channelProducer)
284 {
285 throw ExceptionWithStatus(DW_INTERNAL_ERROR, "PortOutput bindChannelForPODTypePacket: wrong channel implementations returned.");
286 }
287 },
288 dw::core::Logger::Verbosity::DEBUG);
289 }
290
292 {
293 if (!isBound())
294 {
295 throw ExceptionWithStatus(DW_NOT_AVAILABLE, "PortOutput: setOnDataReady: no bound channel");
296 }
297 m_channelProducer->setOnDataReady(opaque, std::move(onDataReady));
298 }
299
300 bool isBound() final
301 {
302 return (nullptr != m_channelProducer);
303 }
304
305 dwStatus wait(dwTime_t timeout)
306 {
307 if (!isBound())
308 {
309 throw ExceptionWithStatus(DW_NOT_AVAILABLE, "PortOutput: wait: no bound channel");
310 }
311
312 return m_channelProducer->wait(timeout);
313 }
314
315 // Node accessors
316 // TODO(unknown): This function's prototype needs to change to properly propagate errors
318 {
319 dwStatus status{DW_FAILURE};
320 GenericData genericData{};
321 if (m_channelProducer)
322 {
323 status = m_channelProducer->get(&genericData);
324 }
325
326 if (DW_SUCCESS != status)
327 {
328 return nullptr;
329 }
330
331 // coverity[autosar_cpp14_a5_1_1_violation] RFD Accepted: TID-2056
332 extractMetadata(genericData)->header.validFields = 0U;
333 return BaseSyncHelper::extractInternalPacket(genericData);
334 }
335
336 // Tx Operations
337 virtual dwStatus send(T* frame)
338 {
339 if (!m_channelProducer)
340 {
341 throw ExceptionWithStatus(DW_NOT_AVAILABLE, "PortOutput: channel not bound");
342 }
343
345 populateDefaultMetadata(payload->header);
346 return m_channelProducer->send(payload);
347 }
348
349 // coverity[autosar_cpp14_a2_10_5_violation] RFD Pending: TID-2053
351 {
352 if (!m_channelProducer)
353 {
354 throw ExceptionWithStatus(DW_NOT_AVAILABLE, "PortOutput: channel not bound");
355 }
356
358 return payload->header;
359 }
360
362 {
363 if (!m_channelProducer)
364 {
365 throw ExceptionWithStatus(DW_NOT_AVAILABLE, "PortOutput: channel not bound");
366 }
367 return m_channelProducer->getSyncSignaler();
368 }
369
370 void setSignalFences(T* frame, dw::core::span<NvSciSyncFence> fences)
371 {
372 m_channelProducer->getSyncSignaler().setSignalFences(BaseSyncHelper::getMetadataPacket(frame), fences);
373 }
374
376 {
377 if (!m_channelProducer)
378 {
379 throw ExceptionWithStatus(DW_NOT_AVAILABLE, "PortOutput: channel not bound");
380 }
381 return m_channelProducer->getSyncWaiter();
382 }
383
384 void getWaitFences(T* frame, dw::core::span<NvSciSyncFence> fences)
385 {
386 m_channelProducer->getSyncWaiter().getWaitFences(BaseSyncHelper::getMetadataPacket(frame), fences);
387 }
388
392 detail::vectorIterable<T> getAllBufferIter()
393 {
394 return detail::vectorIterable<T>(m_channelProducer->getAllBuffers());
395 }
396
397protected:
399 {
400 setSequenceNumber(header, m_sendSeqNum);
401 if (m_sendSeqNum < std::numeric_limits<decltype(m_sendSeqNum)>::max())
402 {
403 m_sendSeqNum++;
404 }
405 else
406 {
407 m_sendSeqNum = std::numeric_limits<decltype(m_sendSeqNum)>::min();
408 }
409 // coverity[autosar_cpp14_a5_1_1_violation] RFD Accepted: TID-2056
410 header.producerId = 0U;
411
413 {
415 header.validFields |= static_cast<uint16_t>(MetadataFlags::METADATA_ITERATION_COUNT);
416 }
417 }
418};
419
420template <typename T>
421constexpr char PortOutput<T>::LOG_TAG[];
422
424
431template <typename T>
432// coverity[autosar_cpp14_a10_1_1_violation]
433class PortInput : public SyncPortHelperInput<T>, public Port
434{
436 "Channel packet type not declared. Ensure channel packet type "
437 "handling is declared with DWFRAMEWORK_DECLARE_PACKET_TYPE_POD "
438 "or DWFRAMEWORK_DECLARE_PACKET_TYPE_RELATION");
439 // coverity[autosar_cpp14_a2_10_5_violation] RFD Pending: TID-2053
440 static constexpr char LOG_TAG[]{"PortInput"};
441
442public:
444 // coverity[autosar_cpp14_a0_1_6_violation]
445 using ApiDataTypeT = T;
448
449 static_assert(std::is_copy_constructible<SpecimenT>::value, "SpecimenT is not copy constructible");
450
451 explicit PortInput(SpecimenT const& ref)
453 , Port()
454 , m_channelConsumer(nullptr)
455 , m_reuse(false)
456 , m_reference(ref)
457 {
458 }
459 explicit PortInput(SpecimenT&& ref)
461 , Port()
462 , m_channelConsumer(nullptr)
463 , m_reuse(false)
464 , m_reference(std::move(ref))
465 {
466 }
467
470 , Port()
471 , m_channelConsumer(nullptr)
472 , m_reuse(false)
473 {
474 }
475
476 explicit PortInput(OnSetSyncAttrs waiterAttrs,
477 OnSetSyncAttrs signalerAttrs = {})
479 , Port()
480 , m_channelConsumer(nullptr)
481 , m_reuse(false)
482 , m_waiterAttrs(waiterAttrs)
483 , m_signalerAttrs(signalerAttrs)
484 {
485 }
486
487 explicit PortInput(SpecimenT const& ref,
488 OnSetSyncAttrs waiterAttrs,
489 OnSetSyncAttrs signalerAttrs = {})
491 , Port()
492 , m_channelConsumer(nullptr)
493 , m_reuse(false)
494 , m_reference(ref)
495 , m_waiterAttrs(waiterAttrs)
496 , m_signalerAttrs(signalerAttrs)
497 {
498 }
499
500 ~PortInput() override = default;
501
502 // Channel Bind
503 dwStatus bindChannel(ChannelObject* channel) override
504 {
505 return ExceptionGuard::guard([&] {
506 if (isBound())
507 {
508 // TODO(chale): this should be an Exception but applications are currently
509 // doing this. Those applications should be fixed.
510 DW_LOGE << dw::core::StringView{"PortInput: bindChannel: attempted to bind the same port twice, ignoring this bind!"} << Logger::State::endl;
511 return;
512 }
513 if (nullptr == channel)
514 {
515 throw ExceptionWithStatus(DW_INVALID_ARGUMENT, "PortInput: bindChannel: expected channel != nullptr");
516 }
517 m_channel = channel;
518
520 GenericDataReference ref{make_specimen<T>(nullptr)};
521
522 if (m_reference.has_value())
523 {
524 ref = make_specimen<T>(&m_reference.value());
525 }
526
527 ref.packetTypeID = BaseSyncHelper::getNewPacketID(ref.packetTypeID);
528 ref.setWaiterAttributes = m_waiterAttrs;
529 ref.setSignalerAttributes = m_signalerAttrs;
530
531 m_channelConsumer = channel->getConsumer(ref);
532 if (nullptr == m_channelConsumer)
533 {
534 throw ExceptionWithStatus(DW_INTERNAL_ERROR, "PortInput bindChannel: wrong channel implementations returned.");
535 }
536 m_reuse = channel->getParams().getReuseEnabled();
537 },
538 dw::core::Logger::Verbosity::DEBUG);
539 }
540
541 bool isBound() override
542 {
543 return !(nullptr == m_channelConsumer);
544 }
545
547 {
548 if (!isBound())
549 {
550 throw ExceptionWithStatus(DW_NOT_AVAILABLE, "PortInput: setOnDataReady: no bound channel");
551 }
552 m_channelConsumer->setOnDataReady(opaque, std::move(onDataReady));
553 }
554
555 // Rx Operations
556 dwStatus wait(dwTime_t timeout)
557 {
558 if (!isBound())
559 {
560 throw ExceptionWithStatus(DW_NOT_AVAILABLE, "PortInput: wait: no bound channel");
561 }
562
563 // For synced packets, the wait can return DW_NOT_AVAILABLE or DW_SUCCESS
564 // if there are no packets to consume. This is because you need to consume
565 // a packet to make sure it's valid or not.
567 {
568 return DW_SUCCESS;
569 }
571 {
572 return DW_NOT_AVAILABLE;
573 }
575 {
576 // coverity[autosar_cpp14_a5_1_1_violation] RFD Accepted: TID-2056
577 timeout = 0;
578 }
579
580 dwTime_t waitTime{nullptr != m_last.get() ? 0 : timeout};
581 dwStatus status{m_channelConsumer->wait(waitTime)};
582 if (nullptr != m_last.get() && (DW_TIME_OUT == status || DW_NOT_AVAILABLE == status))
583 {
584 return DW_SUCCESS;
585 }
586
587 return status;
588 }
589
590 // TODO(unknown): This function's prototype needs to change to properly propagate errors
591 virtual std::shared_ptr<T> recv()
592 {
593 GenericData data{};
594 std::shared_ptr<T> result{};
595 if (!isBound())
596 {
597 return nullptr;
598 }
599
600 // coverity[autosar_cpp14_a0_1_1_violation]
601 T* typedData{nullptr};
602 // coverity[autosar_cpp14_a0_1_1_violation]
603 void* releasePtr{nullptr};
604
606 {
607 // There is a valid packet to consume
609 releasePtr = data.getPointer();
611 }
613 {
614 // There is a buffered packet, but it's not ready to be consumed.
615 return nullptr;
616 }
617 else
618 {
619 dwStatus status{m_channelConsumer->recv(&data)};
620 if (DW_SUCCESS != status)
621 {
622 if (nullptr != m_last)
623 {
624 return m_last;
625 }
626 else
627 {
628 return nullptr;
629 }
630 }
632 {
633 typedData = BaseSyncHelper::extractSyncPacket(data);
634 if (!typedData)
635 {
636 return nullptr;
637 }
638 }
639 else
640 {
642 }
643 releasePtr = data.getPointer();
644 }
645
646 // don't rely on this class's member when releasing packet
647 ChannelObject::Consumer* channelConsumer{m_channelConsumer};
648 // coverity[autosar_cpp14_a5_1_9_violation]
649 result = std::shared_ptr<T>(typedData, [channelConsumer, releasePtr](T*) {
650 channelConsumer->release(releasePtr);
651 });
652 if (m_reuse)
653 {
654 m_last = result;
655 }
656
657 return result;
658 }
659
660 // coverity[autosar_cpp14_a2_10_5_violation] RFD Pending: TID-2053
662 {
663 if (!m_channelConsumer)
664 {
665 throw ExceptionWithStatus(DW_NOT_AVAILABLE, "PortInput: channel not bound");
666 }
667
669 return payload->header;
670 }
671
673 {
674 if (!m_channelConsumer)
675 {
676 throw ExceptionWithStatus(DW_NOT_AVAILABLE, "PortInput: channel not bound");
677 }
678 return m_channelConsumer->getSyncSignaler();
679 }
680
681 void setSignalFences(T* frame, dw::core::span<NvSciSyncFence> fences)
682 {
683 m_channelConsumer->getSyncSignaler().setSignalFences(BaseSyncHelper::getMetadataPacket(frame), fences);
684 }
685
687 {
688 if (!m_channelConsumer)
689 {
690 throw ExceptionWithStatus(DW_NOT_AVAILABLE, "PortInput: channel not bound");
691 }
692 return m_channelConsumer->getSyncWaiter();
693 }
694
695 void getWaitFences(T* frame, dw::core::span<NvSciSyncFence> fences)
696 {
697 m_channelConsumer->getSyncWaiter().getWaitFences(BaseSyncHelper::getMetadataPacket(frame), fences);
698 }
699
703 detail::vectorIterable<T> getAllBufferIter()
704 {
705 return detail::vectorIterable<T>(m_channelConsumer->getAllBuffers());
706 }
707
708private:
709 ChannelObject::Consumer* m_channelConsumer;
710 bool m_reuse;
711 std::shared_ptr<T> m_last;
712 dw::core::Optional<SpecimenT> m_reference;
713 OnSetSyncAttrs m_waiterAttrs;
714 OnSetSyncAttrs m_signalerAttrs;
715};
716
717template <typename T>
718constexpr char PortInput<T>::LOG_TAG[];
719
720} // namespace framework
721} // namespace dw
722
723#endif // DW_FRAMEWORK_PORT_H_
virtual dwStatus recv(GenericData *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:143
virtual dw::core::VectorFixed< GenericData > getAllBuffers()=0
virtual dwStatus get(GenericData *data)=0
virtual dwStatus send(void *data)=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 const ChannelParams & getParams() const =0
virtual Consumer * getConsumer(const GenericDataReference &ref)=0
virtual Producer * getProducer(const GenericDataReference &ref)=0
static dwStatus guard(TryBlock const &tryBlock, ::dw::core::Logger::Verbosity verbosity=::dw::core::Logger::Verbosity::ERROR)
Definition: Exception.hpp:167
virtual ~PortBase()=default
PortInput(OnSetSyncAttrs waiterAttrs, OnSetSyncAttrs signalerAttrs={})
Definition: Port.hpp:476
virtual std::shared_ptr< T > recv()
Definition: Port.hpp:591
dwStatus wait(dwTime_t timeout)
Definition: Port.hpp:556
ChannelObject::SyncSignaler & getSyncSignaler()
Definition: Port.hpp:672
PortInput(SpecimenT const &ref, OnSetSyncAttrs waiterAttrs, OnSetSyncAttrs signalerAttrs={})
Definition: Port.hpp:487
dwStatus bindChannel(ChannelObject *channel) override
Definition: Port.hpp:503
ChannelObject::SyncWaiter & getSyncWaiter()
Definition: Port.hpp:686
typename parameter_traits< T >::SpecimenT SpecimenT
Definition: Port.hpp:446
void setSignalFences(T *frame, dw::core::span< NvSciSyncFence > fences)
Definition: Port.hpp:681
bool isBound() override
Definition: Port.hpp:541
static constexpr PortDirection DIRECTION
Definition: Port.hpp:443
detail::vectorIterable< T > getAllBufferIter()
Definition: Port.hpp:703
ChannelMetadata & getMetadata(T *frame)
Definition: Port.hpp:661
void setOnDataReady(void *opaque, ChannelObject::PacketPool::OnDataReady onDataReady)
Definition: Port.hpp:546
~PortInput() override=default
void getWaitFences(T *frame, dw::core::span< NvSciSyncFence > fences)
Definition: Port.hpp:695
PortInput(SpecimenT &&ref)
Definition: Port.hpp:459
PortInput(SpecimenT const &ref)
Definition: Port.hpp:451
detail::vectorIterable< T > getAllBufferIter()
Definition: Port.hpp:392
dwStatus wait(dwTime_t timeout)
Definition: Port.hpp:305
static constexpr char LOG_TAG[]
Definition: Port.hpp:173
dwStatus bindChannelWithReference(ChannelObject *channel, GenericDataReference &ref)
Definition: Port.hpp:220
ChannelMetadata & getMetadata(T *frame)
Definition: Port.hpp:350
dwStatus bindChannelForPODTypePacket(ChannelObject *channel)
Definition: Port.hpp:254
dwStatus bindChannel(ChannelObject *channel) override
Definition: Port.hpp:214
void setOnDataReady(void *opaque, ChannelObject::PacketPool::OnDataReady onDataReady)
Definition: Port.hpp:291
PortOutput(SpecimenT const &ref)
Definition: Port.hpp:183
typename parameter_traits< T >::SpecimenT SpecimenT
Definition: Port.hpp:167
ChannelObject::SyncSignaler & getSyncSignaler()
Definition: Port.hpp:361
void populateDefaultMetadata(ChannelMetadata &header)
Definition: Port.hpp:398
bool isBound() final
Definition: Port.hpp:300
PortOutput(SpecimenT const &ref, OnSetSyncAttrs signalerAttrs, OnSetSyncAttrs waiterAttrs={})
Definition: Port.hpp:200
void setSignalFences(T *frame, dw::core::span< NvSciSyncFence > fences)
Definition: Port.hpp:370
ChannelObject::SyncWaiter & getSyncWaiter()
Definition: Port.hpp:375
void getWaitFences(T *frame, dw::core::span< NvSciSyncFence > fences)
Definition: Port.hpp:384
static constexpr PortDirection DIRECTION
Definition: Port.hpp:164
PortOutput(SpecimenT &&ref)
Definition: Port.hpp:191
virtual dwStatus send(T *frame)
Definition: Port.hpp:337
ChannelObject * m_channel
Definition: Port.hpp:148
virtual dwStatus bindChannel(ChannelObject *channel)=0
virtual bool isBound()=0
virtual ChannelObject * getChannel()
Definition: Port.hpp:142
T * extractInternalPacket(GenericData genericData)
T * extractSyncPacket(GenericData genericData)
MetadataPayload * getMetadataPacket(T *frame)
void parseDataSynced(const ChannelParams &params) override
T * extractInternalPacket(GenericData genericData)
void parseDataSynced(const ChannelParams &params) override
MetadataPayload * getMetadataPacket(T *frame)
static constexpr const uint32_t DWFRAMEWORK_METADATA_PACKET_TYPE_ID_OFFSET
MetadataPayload * extractMetadata(GenericData packet)
dw::core::Function< void(NvSciSyncAttrList)> OnSetSyncAttrs
OnSetSyncAttrs setSignalerAttributes
lambda to set the signaler attributes of the endpoint.
ChannelPacketTypeID packetTypeID
The ID of the type of the endpoint.
uint16_t validFields
Bit map defining which ChannelMetadata fields are set. See MetadataFlags.
uint32_t ChannelPacketTypeID
constexpr ChannelPacketTypeID DWFRAMEWORK_PACKET_ID_DEFAULT
uint32_t producerId
Id of the producer channel.
uint32_t iterationCount
Producer iteration count.
void setSequenceNumber(ChannelMetadata &header, uint32_t const &sequenceNum)
OnSetSyncAttrs setWaiterAttributes
lambda to set the waiter attributes of the endpoint.
@ METADATA_ITERATION_COUNT
Producer iteration count is set.
@ SHMEM_LOCAL
local shared memory
Definition: Buffer.hpp:40
ChannelPacketTypeID getNewPacketID(ChannelPacketTypeID packetTypeID)
void stampSyncCount(uint32_t &syncCountOut) const