Compute Graph Framework SDK Reference  5.12
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
36#include <nvscisync.h>
37
38namespace dw
39{
40namespace framework
41{
42
43using ChannelPacketConstructor = dw::core::Function<std::unique_ptr<IChannelPacket>(GenericData dataSpecimen, dwContextHandle_t context)>;
44using ChannelPacketConstructorSignature = std::pair<ChannelPacketTypeID, ChannelType>;
45// coverity[autosar_cpp14_a0_1_6_violation]
46using ChannelPacketConstructorRegistration = std::pair<ChannelPacketConstructorSignature, ChannelPacketConstructor>;
47
48class ChannelFactoryImpl;
49
53// coverity[autosar_cpp14_a0_1_6_violation]
55{
56public:
78
84 ChannelFactory(dwContextHandle_t ctx = DW_NULL_HANDLE);
85 virtual ~ChannelFactory() = default;
86
93 std::shared_ptr<ChannelObject> makeChannel(const char* channelParams);
94
95 // Get the packet factory so registered packet constructors can be accessed directly
97
98 // Get the nvscisync module used by underlying NvSciStream channels. This NvSciSyncModule is owned
99 // internally by channels and shall not be freed by application.
100 NvSciSyncModule getNvSciSyncModule();
101
111
120
121 using OnDispatchDataReady = dw::core::Function<void(void* opaque, ChannelObject::PacketPool::OnDataReady)>;
123
132 dw::core::Optional<ChannelEvent> popEvent(dwTime_t timeout);
133
139 dw::core::Optional<ChannelError> popError();
140
141private:
142 std::shared_ptr<ChannelFactoryImpl> m_pimpl;
143};
144
145} // namespace framework
146} // namespace dw
147
148#endif // DW_FRAMEWORK_ICHANNELFACTORY_HPP_
NvSciSyncModule getNvSciSyncModule()
virtual ~ChannelFactory()=default
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)
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()
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