Compute Graph Framework SDK Reference  5.8
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-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_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>;
46using ChannelPacketConstructorRegistration = std::pair<ChannelPacketConstructorSignature, ChannelPacketConstructor>;
47
48class ChannelFactoryImpl;
49
51{
52public:
55
56 ChannelFactory(dwContextHandle_t ctx = DW_NULL_HANDLE);
57 virtual ~ChannelFactory() = default;
58 // Create a channel with given channelParams
59 std::shared_ptr<ChannelObject> makeChannel(const char* channelParams);
60
61 using OnDispatchDataReady = dw::core::Function<void(void* opaque, ChannelObject::PacketPool::OnDataReady)>;
63
65
68
69 // Get the packet factory so registered packet constructors can be accessed directly
71
72 // Get the nvscisync module used by underlying NvSciStream channels. This NvSciSyncModule is owned
73 // internally by channels and shall not be freed by application.
74 NvSciSyncModule getNvSciSyncModule();
75
77
78private:
79 std::shared_ptr<ChannelFactoryImpl> m_pimpl;
80};
81
82} // namespace framework
83} // namespace dw
84
85#endif // DW_FRAMEWORK_ICHANNELFACTORY_HPP_
NvSciSyncModule getNvSciSyncModule()
virtual ~ChannelFactory()=default
ChannelFactory(dwContextHandle_t ctx=DW_NULL_HANDLE)
std::shared_ptr< ChannelObject > makeChannel(const char *channelParams)
static void unregisterPacketConstructor(const ChannelPacketConstructorSignature &signature)
void setOnRegisterTraceWriter(ChannelOnRegisterTraceWriter onRegisterTraceWriter)
void setOnRegisterTraceReader(ChannelOnRegisterTraceReader onRegisterTraceReader)
dw::core::Function< void(void *opaque, ChannelObject::PacketPool::OnDataReady)> OnDispatchDataReady
void setOnDispatchDataReady(OnDispatchDataReady dispatchDataReady)
static void registerPacketConstructor(const ChannelPacketConstructorSignature &signature, const ChannelPacketConstructor &constructor)
void setTraceMode(ChannelTraceMode traceMode)
ChannelPacketFactoryPtr getPacketFactory()
dw::core::Function< void()> OnDataReady
Definition: Channel.hpp:136
std::pair< ChannelPacketTypeID, ChannelType > ChannelPacketConstructorSignature
std::shared_ptr< IChannelPacketFactory > ChannelPacketFactoryPtr
dw::core::Function< ChannelTraceWriteCallback(const char *channelID)> ChannelOnRegisterTraceWriter
dw::core::Function< std::unique_ptr< IChannelPacket >(GenericData dataSpecimen, dwContextHandle_t context)> ChannelPacketConstructor
std::pair< ChannelPacketConstructorSignature, ChannelPacketConstructor > ChannelPacketConstructorRegistration
dw::core::Function< ChannelTraceReadCallback(const char *channelID)> ChannelOnRegisterTraceReader
Definition: Exception.hpp:47