15#include <peak/dll_interface/peak_dll_interface_util.hpp>
107 friend ClassCreator<DataStreamDescriptor>;
112 std::weak_ptr<Device> m_parentDevice;
113 std::weak_ptr<DataStream> m_openedDataStream;
129 : m_backendHandle(dataStreamDescriptorHandle)
130 , m_parentDevice(parentDevice)
131 , m_key(QueryStringFromCInterfaceFunction([&](char* key, size_t* keySize) {
143 return LockOrThrow(m_parentDevice);
148 auto dataStreamHandle = QueryNumericFromCInterfaceFunction<PEAK_DATA_STREAM_HANDLE>(
153 auto dataStream = std::make_shared<ClassCreator<DataStream>>(dataStreamHandle, m_parentDevice);
154 m_openedDataStream = dataStream;
160 return LockOrThrowOpenedModule(m_openedDataStream);
170 return !m_openedDataStream.expired();
175 auto moduleDescriptorHandle = QueryNumericFromCInterfaceFunction<PEAK_MODULE_DESCRIPTOR_HANDLE>(
178 m_backendHandle, _moduleDescriptorHandle);
181 return moduleDescriptorHandle;
PEAK_COMMON_NO_DISCARD std::shared_ptr< DataStream > OpenedDataStream() const
Returns the DataStream that was opened with this DataStreamDescriptor.
Definition peak_data_stream_descriptor.hpp:158
DataStreamDescriptor & operator=(DataStreamDescriptor &&other)=delete
DataStreamDescriptor(DataStreamDescriptor &&other)=delete
DataStreamDescriptor(const DataStreamDescriptor &other)=delete
PEAK_COMMON_NO_DISCARD bool IsOpened() const
Returns whether the data stream is open.
Definition peak_data_stream_descriptor.hpp:168
~DataStreamDescriptor() override=default
PEAK_COMMON_NO_DISCARD std::shared_ptr< DataStream > OpenDataStream()
Opens the data stream.
Definition peak_data_stream_descriptor.hpp:146
PEAK_COMMON_NO_DISCARD std::shared_ptr< Device > ParentDevice() const
Returns the parent device.
Definition peak_data_stream_descriptor.hpp:141
PEAK_COMMON_NO_DISCARD std::string Key() const
Returns the unique key.
Definition peak_data_stream_descriptor.hpp:136
DataStreamDescriptor & operator=(const DataStreamDescriptor &other)=delete
PEAK_COMMON_NO_DISCARD std::shared_ptr< DataStream > EnsureOpenedDataStream()
Returns the opened data stream or opens it if it is not already open.
Definition peak_data_stream_descriptor.hpp:163
DataStreamDescriptor()=delete
Represents a GenTL Device module, i.e. a local virtual Device proxy for the actual hardware RemoteDev...
Definition peak_device.hpp:53
ModuleDescriptor()=default
virtual PEAK_MODULE_DESCRIPTOR_HANDLE ModuleDescriptorHandle() const =0
The "core" namespace contains the direct GenAPI and GenTL wrapper.
Definition peak_buffer.hpp:32
The "peak" namespace directly contains convenience functionality like the DeviceManager as well as th...
Definition peak_buffer.hpp:29
struct PEAK_DATA_STREAM * PEAK_DATA_STREAM_HANDLE
Definition peak_backend.h:399
struct PEAK_MODULE_DESCRIPTOR * PEAK_MODULE_DESCRIPTOR_HANDLE
Definition peak_backend.h:415
struct PEAK_DATA_STREAM_DESCRIPTOR * PEAK_DATA_STREAM_DESCRIPTOR_HANDLE
Definition peak_backend.h:395
PEAK_C_API PEAK_DataStreamDescriptor_ToModuleDescriptor(PEAK_DATA_STREAM_DESCRIPTOR_HANDLE dataStreamDescriptorHandle, PEAK_MODULE_DESCRIPTOR_HANDLE *moduleDescriptorHandle)
Casts the given data stream descriptor to a module descriptor.
PEAK_C_API PEAK_DataStreamDescriptor_GetKey(PEAK_DATA_STREAM_DESCRIPTOR_HANDLE dataStreamDescriptorHandle, char *key, size_t *keySize)
Asks the given data stream descriptor for its key.
PEAK_C_API PEAK_DataStreamDescriptor_OpenDataStream(PEAK_DATA_STREAM_DESCRIPTOR_HANDLE dataStreamDescriptorHandle, PEAK_DATA_STREAM_HANDLE *dataStreamHandle)
Opens the data stream being associated with the given data stream descriptor.
#define PEAK_COMMON_NO_DISCARD
Definition peak_common_defines.h:89
#define PEAK_C_ABI_PREFIX
Definition peak_dll_defines.h:13