ADTF
Loading...
Searching...
No Matches
pin_creation.h
Go to the documentation of this file.
1
7#pragma once
8#include "pin.h"
9#include "samplewriter.h"
10#include "samplereader.h"
11
12#include <type_traits>
13
14namespace adtf
15{
16namespace streaming
17{
18namespace ant
19{
20
36template<typename DATA_BINDING_IMPL_TYPE>
37tResult create_pin(DATA_BINDING_IMPL_TYPE& oDataBindingImpl,
38 cSampleWriter& oWriter,
39 const char* strNameOfWriterAndPin,
40 const ucom::iobject_ptr<const IStreamType>& pStreamType,
41 ucom::iobject_ptr<IOutPin>& pPinCreated)
42{
43 oWriter.SetName(strNameOfWriterAndPin);
44 oWriter.SetType(pStreamType);
45
47 oWriter.ResetPin(pOutPin);
48 adtf::ucom::object_ptr<IPin> pPin = pOutPin;
49 RETURN_IF_FAILED(oDataBindingImpl.RegisterPin(pPin));
52}
53
68template<typename DATA_BINDING_IMPL_TYPE>
69tResult create_pin(DATA_BINDING_IMPL_TYPE& oDataBindingImpl,
70 cSampleWriter& oWriter,
71 const char* strNameOfWriterAndPin,
73{
75 return create_pin(oDataBindingImpl, oWriter, strNameOfWriterAndPin, pStreamType, pPinCreated);
76}
77
92template<typename DATA_BINDING_IMPL_TYPE>
93tResult create_pin(DATA_BINDING_IMPL_TYPE& oDataBindingImpl,
94 cSampleWriter& oWriter,
95 const char* strNameOfWriterAndPin,
96 const adtf::ucom::iobject_ptr<IStreamType>& pStreamType)
97{
98 return create_pin(oDataBindingImpl, oWriter, strNameOfWriterAndPin, adtf::ucom::ucom_object_ptr_cast<const IStreamType>(pStreamType));
99}
100
112template<typename DATA_BINDING_IMPL_TYPE>
113tResult create_pin(DATA_BINDING_IMPL_TYPE& oDataBindingImpl,
114 cSampleReader& oReader,
115 const char* strNameOfReaderAndPin,
116 const ucom::iobject_ptr<const IStreamType>& pStreamType,
117 ucom::iobject_ptr<IInPin>& pPinCreated)
118{
119 oReader.SetName(strNameOfReaderAndPin);
120 oReader.SetType(pStreamType);
121
123 oReader.ResetPin(pInPin);
124 adtf::ucom::object_ptr<IPin> pPin = pInPin;
125 RETURN_IF_FAILED(oDataBindingImpl.RegisterPin(pPin));
128}
129
140template<typename DATA_BINDING_IMPL_TYPE>
141tResult create_pin(DATA_BINDING_IMPL_TYPE& oDataBindingImpl,
142 cSampleReader& oReader,
143 const char* strNameOfReaderAndPin,
144 const ucom::iobject_ptr<const IStreamType>& pStreamType)
145{
147 return create_pin(oDataBindingImpl, oReader, strNameOfReaderAndPin, pStreamType, pPinCreated);
148}
149
150
161template<typename DATA_BINDING_IMPL_TYPE>
162tResult create_pin(DATA_BINDING_IMPL_TYPE& oDataBindingImpl,
163 cSampleReader& oReader,
164 const char* strNameOfReaderAndPin,
165 const adtf::ucom::iobject_ptr<IStreamType>& pStreamType)
166{
167 return create_pin(oDataBindingImpl, oReader, strNameOfReaderAndPin, adtf::ucom::ucom_object_ptr_cast<const IStreamType>(pStreamType));
168}
169} //namespace ant
170
171namespace flash
172{
173
174template<typename DATA_BINDING_IMPL_TYPE, typename READER_OR_WRITER, typename PIN_INTERFACE>
175tResult create_pin(DATA_BINDING_IMPL_TYPE& oDataBindingImpl,
176 READER_OR_WRITER& oStreamer,
178{
179 typedef typename std::conditional<std::is_base_of<flash::ISampleReader, READER_OR_WRITER>::value, quiet::cInPin, quiet::cOutPin>::type pin_type;
180 adtf::util::cString strNameOfReaderAndPin;
181 oStreamer.GetName(adtf_string_intf(strNameOfReaderAndPin));
182
183 auto pInPin = adtf::ucom::make_object_ptr<pin_type>(strNameOfReaderAndPin);
184 oStreamer.SetStreamerPin(ucom::ant::ucom_object_ptr_cast<flash::IStreamerPin>(pInPin));
185 adtf::ucom::object_ptr<IPin> pPin = pInPin;
186 RETURN_IF_FAILED(oDataBindingImpl.RegisterPin(pPin));
188}
189
190template<typename DATA_BINDING_IMPL_TYPE, typename READER_OR_WRITER>
191tResult create_pin(DATA_BINDING_IMPL_TYPE& oDataBindingImpl,
192 READER_OR_WRITER& oStreamer)
193{
194 typedef typename std::conditional<std::is_base_of<flash::ISampleReader, READER_OR_WRITER>::value, quiet::cInPin, quiet::cOutPin>::type pin_type;
195 adtf::util::cString strNameOfReaderAndPin;
196 oStreamer.GetName(adtf_string_intf(strNameOfReaderAndPin));
197
198 auto pInPin = adtf::ucom::make_object_ptr<pin_type>(strNameOfReaderAndPin);
199 oStreamer.SetStreamerPin(ucom::ant::ucom_object_ptr_cast<flash::IStreamerPin>(pInPin));
200 adtf::ucom::object_ptr<IPin> pPin = pInPin;
201 return oDataBindingImpl.RegisterPin(pPin);
202}
203
204template<typename DATA_BINDING_IMPL_TYPE, typename READER_OR_WRITER, typename PIN_INTERFACE>
205tResult create_pin(DATA_BINDING_IMPL_TYPE& oDataBindingImpl,
206 READER_OR_WRITER& oStreamer,
207 const char* strNameOfReaderAndPin,
209 ucom::ant::iobject_ptr<PIN_INTERFACE>& pCreatedPin)
210{
211 oStreamer.SetName(strNameOfReaderAndPin);
212 oStreamer.SetType(pStreamType);
213
214 return create_pin(oDataBindingImpl, oStreamer, pCreatedPin);
215}
216
217template<typename DATA_BINDING_IMPL_TYPE, typename READER_OR_WRITER>
218tResult create_pin(DATA_BINDING_IMPL_TYPE& oDataBindingImpl,
219 READER_OR_WRITER& oStreamer,
220 const char* strNameOfReaderAndPin,
221 const ucom::ant::iobject_ptr<const ant::IStreamType>& pStreamType)
222{
223 oStreamer.SetName(strNameOfReaderAndPin);
224 oStreamer.SetType(pStreamType);
225
226 return create_pin(oDataBindingImpl, oStreamer);
227}
228
229}
230
231using flash::create_pin;
232
233} //namespace streaming
234} //namespace adtf
A_UTILS_NS::cResult tResult
For backwards compatibility and to bring latest version into scope.
Definition result.h:736
#define RETURN_NOERROR
Return status ERR_NOERROR, which requires the calling function's return type to be tResult.
Definition result.h:29
The default Sample Reader will read the incomung Stream of a IInPin. This sample reader has no intern...
Definition samplereader.h:177
Definition samplewriter.h:34
void ResetPin(ucom::ant::object_ptr< PINTYPE > &pPin)
Definition samplereader.h:95
tResult SetType(const ucom::ant::iobject_ptr< const IStreamType > &pStreamType)
Definition samplereader.h:140
void SetName(const char *strName)
Definition samplereader.h:84
virtual tResult Reset(const iobject_ptr< T > &i_oOther)=0
Reset this object_ptr<> with the content of another iobject_ptr<>
Base object pointer to realize binary compatible reference counting in interface methods.
Definition object_ptr_intf.h:112
Definition object_ptr.h:384
Namespace for all functionality of the ADTF Streaming SDK provided since v3.0.
Definition bindingproxyoutport.h:16
tResult create_pin(DATA_BINDING_IMPL_TYPE &oDataBindingImpl, cSampleWriter &oWriter, const char *strNameOfWriterAndPin, const ucom::iobject_ptr< const IStreamType > &pStreamType, ucom::iobject_ptr< IOutPin > &pPinCreated)
Definition pin_creation.h:37
Namespace for the ADTF Streaming SDK.
Definition bindingproxyinport.h:14
object_ptr< T > ucom_object_ptr_cast(object_ptr< T > oCasted)
Create an object_ptr with an already shared resource of implicitly convertible type.
Definition object_ptr_utilities.h:104
object_ptr< T > ucom_object_ptr_cast(object_ptr< T > oCasted)
Alias always bringing the latest version of ant::ucom_object_ptr_cast() into scope.
Definition object_ptr_utilities.h:104
ant::iobject_ptr< T > iobject_ptr
Alias always bringing the latest version of ant::iobject_ptr into scope.
Definition object_ptr_intf.h:437
object_ptr< Implementation > make_object_ptr(Args &&... args)
Alias always bringing the latest version of ant::make_object_ptr() into scope.
Definition object_ptr_utilities.h:129
Namespace for all functionality provided by ADTF and its SDKs.
Definition adtf_client_connector.h:14
#define adtf_string_intf(__string__)
Definition string_intf.h:465