ADTF  3.14.2
streamtype_intf.h
Go to the documentation of this file.
1 
7 #pragma once
8 
9 #include <adtfucom3/adtf_ucom3.h>
10 #include <adtfbase/string_intf.h>
11 #include <adtfbase/property_intf.h>
12 #include <adtfbase/properties.h>
13 #include <adtfucom3/adtf_ucom3.h>
14 
15 namespace adtf
16 {
17 namespace streaming
18 {
19 namespace ant
20 {
21 class IStreamType;
22 
37 {
38 protected:
40  ~IStreamMetaType() = default;
41 public:
42 
43 public:
45  ADTF_IID(IStreamMetaType, "streamtypedef.ant.streaming.adtf.iid");
46 
53  virtual tResult GetMetaTypeName(base::ant::IString&& strTypeName) const = 0;
54 
59  virtual adtf::util::tVersion GetVersion() const = 0;
60 
68 
77  virtual tResult GetParent(ucom::ant::iobject_ptr<const IStreamMetaType>& pParent) const = 0;
78 
91  virtual tResult IsCompatible(const IStreamType& oTypeToCheck, const IStreamType& oExpectedType) const = 0;
92 };//class IStreamMetaType
93 
101 {
102 protected:
104  ~IStreamType() = default;
105 
106 public:
108  ADTF_IID(IStreamType, "streamtype.ant.streaming.adtf.iid");
109 
116  virtual tResult GetMetaTypeName(base::ant::IString&& strTypeName) const = 0;
117 
122  virtual adtf::util::tVersion GetVersion() const = 0;
123 
131 
138  virtual tResult GetConfig(ucom::ant::iobject_ptr<const base::ant::IProperties>& pProperties) const = 0;
139 
146  virtual tResult GetMetaType(ucom::ant::iobject_ptr<const IStreamMetaType>& pMetaType) const = 0;
147 };//class IStreamType
148 
157 template<typename T>
158 bool operator==(const IStreamType& oStreamType, T /* oValue */)
159 {
160  adtf::util::cString strMetaTypeName;
161  oStreamType.GetMetaTypeName(adtf_string_intf(strMetaTypeName));
162  return strMetaTypeName.IsEqual(T::MetaTypeName);
163 }
164 
174 template<typename T>
175 bool operator!=(const IStreamType& oStreamType, T oValue)
176 {
177  return !(oStreamType == oValue);
178 }
179 
188 template<typename VALUETYPE>
189 tResult set_property(IStreamType& oStreamType, const char* strNameOfValue, VALUETYPE oValue)
190 {
192  RETURN_IF_FAILED(oStreamType.GetConfig(pProperties));
193  return adtf::base::set_property<VALUETYPE>(*pProperties, strNameOfValue, oValue);
194 }
195 
203 inline tResult set_property(IStreamType& oStreamType, const char* strNameOfValue, const char* poValue)
204 {
206  RETURN_IF_FAILED(oStreamType.GetConfig(pProperties));
207  return adtf::base::set_property<adtf_util::cString>(*pProperties, strNameOfValue, adtf_util::cString(poValue));
208 }
209 
218 template<typename VALUETYPE>
219 VALUETYPE get_property(const IStreamType& oStreamType, const char* strNameOfValue, VALUETYPE oDefaultValue)
220 {
222  if (IS_OK(oStreamType.GetConfig(pProperties)))
223  {
224  return adtf::base::get_property<VALUETYPE>(*pProperties, strNameOfValue, oDefaultValue);
225  }
226  else
227  {
228  return oDefaultValue;
229  }
230 }
238 template<typename VALUETYPE>
239 VALUETYPE get_property(const IStreamType& oStreamType, const char* strNameOfValue)
240 {
241  return get_property<VALUETYPE>(oStreamType, strNameOfValue, VALUETYPE());
242 }
243 
244 } //namespace ant
245 
246 namespace flash
247 {
248 
256 tResult is_compatible(const ant::IStreamType& oCheckedType,
257  const ant::IStreamType& oExpectedType);
258 
268 
276 tResult is_compatible(const ant::IStreamType& oCheckedType,
278 
287  const ant::IStreamType& oExpectedType);
288 
294 template <typename T>
296 {
298  typedef char one;
300  typedef long two;
301 
306  template <typename C> static one test( decltype(&C::MetaTypeName) ) ;
307 
312  template <typename C> static two test(...);
313 
314 public:
318  enum { value = sizeof(test<T>(nullptr)) == sizeof(char) };
319 };
320 
321 }
322 
323 namespace ant
324 {
325 
335 template<typename T,
336  typename std::enable_if_t<flash::is_stream_meta_type<T>::value, int> = 0>
338  const T& oValue)
339 {
340  if (!pStreamType.Get())
341  {
342  return false;
343  }
344  return *pStreamType.Get() == oValue;
345 }
346 
356 template<typename T,
357  typename std::enable_if_t<flash::is_stream_meta_type<T>::value, int> = 0>
359  const T& oValue)
360 {
361  return !(pStreamType == oValue);
362 }
363 
364 }
365 
366 using ant::IStreamMetaType;
367 using ant::IStreamType;
368 using ant::get_property;
369 using ant::set_property;
371 using flash::is_stream_meta_type;
372 
373 } //namespac streaming
374 } // namespace adtf
Copyright © Audi Electronics Venture GmbH.
The IString interface provides methods for getting and setting strings through abstract interfaces.
Definition: string_intf.h:24
Defines access methods for a Stream Meta Type - see also Stream Type and Stream Meta Type for more in...
virtual adtf::util::tVersion GetVersion() const =0
Get version of a Stream Type.
virtual tResult GetMetaTypeName(base::ant::IString &&strTypeName) const =0
Gets the unique meta type name.
~IStreamMetaType()=default
not destructable
virtual tResult IsCompatible(const IStreamType &oTypeToCheck, const IStreamType &oExpectedType) const =0
Compares the Stream Type oTypeToCheck based on this meta type - see Default Stream Meta Types in ADTF...
virtual tResult GetParent(ucom::ant::iobject_ptr< const IStreamMetaType > &pParent) const =0
This GetParent function is deprecated.
virtual tResult GetDefaultConfig(ucom::ant::iobject_ptr< const base::ant::IProperties > &pProperties) const =0
Get the default configuration values for a Stream Type.
ADTF_IID(IStreamMetaType, "streamtypedef.ant.streaming.adtf.iid")
Interface ID for the Stream Typedef interface.
Defines access methods for the interface of a Stream Type - see also Stream Type and Stream Meta Type...
virtual adtf::util::tVersion GetVersion() const =0
Get version of this instance of the StreamMetaType.
virtual tResult GetMetaTypeName(base::ant::IString &&strTypeName) const =0
Get the meta type name of this instance.
ADTF_IID(IStreamType, "streamtype.ant.streaming.adtf.iid")
Interface ID for the Stream Type interface.
virtual tResult GetMetaType(ucom::ant::iobject_ptr< const IStreamMetaType > &pMetaType) const =0
Get the Stream Meta Type definition of the Stream Type.
~IStreamType()=default
not destructable
virtual tResult GetConfig(ucom::ant::iobject_ptr< const base::ant::IProperties > &pProperties) const =0
Get all properties of a Stream Type (read only) - const correct.
virtual tResult GetConfig(ucom::ant::iobject_ptr< base::ant::IProperties > &pProperties)=0
Get all properties of a Stream Type (read/write)
type traits concept test template to check wether a type T is a type can be used for Stream Meta Type...
static two test(...)
negative test function to test if type T has a string literal MetaTypeName defined.
static one test(decltype(&C::MetaTypeName))
test function to test if type T has a string literal MetaTypeName defined.
Base class for every interface type within the uCOM.
Definition: object_intf.h:31
virtual T * Get() const =0
Get raw pointer to shared object.
Base object pointer to realize binary compatible reference counting in interface methods.
Object pointer implementation used for reference counting on objects of type IObject.
Definition: object_ptr.h:158
bool operator==(const tStreamImageFormat &sLeft, const tStreamImageFormat &sRight)
is equal operator to compare tStreamImageFormat
VALUETYPE get_property(const IStreamType &oStreamType, const char *strNameOfValue, VALUETYPE oDefaultValue)
Gets the property of the given oStreamType.
tResult set_property(IStreamType &oStreamType, const char *strNameOfValue, VALUETYPE oValue)
Sets the property of the given oStreamType to the value oValue.
bool operator!=(const tStreamImageFormat &sLeft, const tStreamImageFormat &sRight)
is not equal operator to compare tStreamImageFormat
tResult is_compatible(const ant::IStreamType &oCheckedType, const ant::IStreamType &oExpectedType)
Checks whether oCheckedType is compatible with oExpectedType.
Namespace for entire ADTF SDK.
Copyright © Audi Electronics Venture GmbH.
Copyright © Audi Electronics Venture GmbH.
Copyright © Audi Electronics Venture GmbH.
#define adtf_string_intf(__string__)
The adtf_string_intf Macro helps to easily create a rvalue reference of a adtf::util::cString.
Definition: string_intf.h:285
#define RETURN_IF_FAILED(s)
returns if the expression returns a failed tResult or throws an exception.

Copyright © Audi Electronics Venture GmbH. All rights reserved. (Generated on Tue May 10 2022 by doxygen 1.9.1)