Compute Graph Framework SDK Reference  5.16
ChannelFactory.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) 2020-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_ICHANNELFACTORY_HPP_
32#define DW_FRAMEWORK_ICHANNELFACTORY_HPP_
33
37#include <nvscisync.h>
38
39namespace dw
40{
41namespace framework
42{
43
44using ChannelPacketConstructor = dw::core::Function<std::unique_ptr<IChannelPacket>(GenericData dataSpecimen, dwContextHandle_t context)>;
45using ChannelPacketConstructorSignature = std::pair<ChannelPacketTypeID, ChannelType>;
46// coverity[autosar_cpp14_a0_1_6_violation]
47using ChannelPacketConstructorRegistration = std::pair<ChannelPacketConstructorSignature, ChannelPacketConstructor>;
48
49class ChannelFactoryImpl;
50
54// coverity[autosar_cpp14_a0_1_6_violation]
55// coverity[autosar_cpp14_m3_4_1_violation]
57{
58public:
80
86 explicit ChannelFactory(dwContextHandle_t ctx = DW_NULL_HANDLE);
87 virtual ~ChannelFactory() = default;
88
95 std::shared_ptr<ChannelObject> makeChannel(const char* channelParams);
96
97 // Get the packet factory so registered packet constructors can be accessed directly
99
100 // Get the nvscisync module used by underlying NvSciStream channels. This NvSciSyncModule is owned
101 // internally by channels and shall not be freed by application.
102 NvSciSyncModule getNvSciSyncModule();
103
108 void setAffinity(uint32_t affinity);
109
114 void setPriority(int32_t priority);
115
125
134
135 using OnDispatchDataReady = dw::core::Function<void(void* opaque, ChannelObject::PacketPool::OnDataReady)>;
137
146 dw::core::Optional<ChannelEvent> popEvent(dwTime_t timeout);
147
153 dw::core::Optional<ChannelError> popError();
154
160 void setFsiComCreateOverrider(std::function<std::shared_ptr<IChannelFsiCom>(uint8_t, const char*)>&& overrider);
161
162private:
163 std::shared_ptr<ChannelFactoryImpl> m_pimpl;
164};
165
166} // namespace framework
167} // namespace dw
168
169#endif // DW_FRAMEWORK_ICHANNELFACTORY_HPP_
NvSciSyncModule getNvSciSyncModule()
virtual ~ChannelFactory()=default
void setPriority(int32_t priority)
ChannelFactory(dwContextHandle_t ctx=DW_NULL_HANDLE)
Construct a new Channel Factory object.
std::shared_ptr< ChannelObject > makeChannel(const char *channelParams)
static void unregisterPacketConstructor(const ChannelPacketConstructorSignature &signature)
void setAffinity(uint32_t affinity)
dw::core::Function< void(void *opaque, ChannelObject::PacketPool::OnDataReady)> OnDispatchDataReady
void setOnDispatchDataReady(OnDispatchDataReady dispatchDataReady)
static void registerPacketConstructor(const ChannelPacketConstructorSignature &signature, const ChannelPacketConstructor &constructor)
dw::core::Optional< ChannelEvent > popEvent(dwTime_t timeout)
dw::core::Optional< ChannelError > popError()
ChannelPacketFactoryPtr getPacketFactory()
void setFsiComCreateOverrider(std::function< std::shared_ptr< IChannelFsiCom >(uint8_t, const char *)> &&overrider)
dw::core::Function< void()> OnDataReady
Definition: Channel.hpp:143
std::pair< ChannelPacketTypeID, ChannelType > ChannelPacketConstructorSignature
std::shared_ptr< IChannelPacketFactory > ChannelPacketFactoryPtr
dw::core::Function< std::unique_ptr< IChannelPacket >(GenericData dataSpecimen, dwContextHandle_t context)> ChannelPacketConstructor
std::pair< ChannelPacketConstructorSignature, ChannelPacketConstructor > ChannelPacketConstructorRegistration
Definition: Buffer.hpp:40