ADTF
property_intf.h
Go to the documentation of this file.
1 
7 #pragma once
8 #include "rawmemory_intf.h"
9 #include "string_intf.h"
10 #include <adtfucom3/adtf_ucom3.h>
11 #include <adtf_base_deprecated.h>
12 
13 namespace adtf
14 {
15 namespace base
16 {
17 namespace ant
18 {
19 
25  class IRawValue
26  {
27  protected:
29  virtual ~IRawValue() = default;
30 
31  public:
42  virtual tResult FromRaw(const IRawMemory& oRawValue) = 0;
52  virtual tResult ToRaw(IRawMemory&& oRawValue) const = 0;
53  };
60  class IPropertyValue : public IRawValue
61  {
62  public:
63  ~IPropertyValue() = default;
64 
65  public:
77  virtual tResult GetType(IString&& strType) const = 0;
86  virtual tResult Set(const IPropertyValue& oValue) = 0;
95  virtual tResult FromString(const IString& strValueAsString) = 0;
96 
105  virtual tResult ToString(IString&& strIToString) const = 0;
106  };
107 
108  class IProperties;
109 
118  class IProperty
119  {
120  public:
121  virtual ~IProperty() = default;
122 
123  public:
124  virtual const IPropertyValue* GetValue() const = 0;
125  virtual IPropertyValue* GetValue() = 0;
126  virtual tResult SetValue(const IPropertyValue& oValue) = 0;
127 
128  virtual tResult GetName(IString&& strName) const = 0;
129  virtual tResult SetName(const IString& strName) = 0;
130 
131  virtual tResult Set(const IProperty& oProp) = 0;
132 
133  virtual bool HasProperties() const = 0;
134  virtual bool HasAttachedProperties() const = 0;
135 
137  virtual tResult SetProperties(const IProperties& pProperties) = 0;
138 
142  ADTF3_DEPRECATED("Attachments are deprecated, they suffer from issues with observers")
143  virtual tResult AttachProperties(const ucom::ant::iobject_ptr<IProperties>& pProperties) = 0;
144 
148  ADTF3_DEPRECATED("Attachments are deprecated, they suffer from issues with observers")
149  virtual tResult GetAttachedProperties(IProperty& pProperty) const = 0;
150 
154  ADTF3_DEPRECATED("Attachments are deprecated, they suffer from issues with observers")
155  virtual tResult DetachProperties() = 0;
156 
158  virtual tResult GetProperties(ucom::ant::iobject_ptr<IProperties>& pSubProperties) = 0;
160  virtual tResult GetProperties(ucom::ant::iobject_ptr<const IProperties>& pProperties) const = 0;
161  };
162 
172  bool operator==(const IProperty& oPropertyLeft, const IProperty& oPropertyRight);
173 
183  bool operator!=(const IProperty& oPropertyLeft, const IProperty& oPropertyRight);
184 
190  {
191  protected:
193  ~IPropertyObserver() = default;
194  public:
201  virtual void Notify(const IProperty& oProperty) = 0;
202  };
203 
213  {
214  public:
216  ADTF_IID(IProperties, "properties.ant.base.adtf.iid");
217 
218  protected:
220  ~IProperties() = default;
221 
222  public:
227  virtual bool Exists(const char* strName) const = 0;
228 
235  virtual tResult Get(IProperties& pProperties) const = 0;
236 
243  virtual tResult Set(const IProperties& pProperties) = 0;
244 
252  virtual size_t GetSize() const = 0;
253 
264  virtual tResult GetProperty(const char* strName, IProperty& pProperty) const = 0;
265  virtual tResult SetProperty(const IProperty& pProperty) = 0;
266  virtual tResult SetPropertyByPath(const char* strParentPath, const IProperty& pProperty) = 0;
267 
268  virtual tResult RemoveProperty(const char* strName) = 0;
269 
270  virtual tResult RegisterPropertyObserver(const char* strPropertyName,
271  IPropertyObserver& oObserver) = 0;
272  virtual tResult UnregisterPropertyObserver(IPropertyObserver& oObserver) = 0;
273  };
274 
285  bool operator==(const IProperties& oPropertiesLeft, const IProperties& oPropertiesRight);
286 
297  bool operator!=(const IProperties& oPropertiesLeft, const IProperties& oPropertiesRight);
298 
299 } //namespace ant
300 
301 namespace spider
302 {
303 
311 tResult is_equal(const ant::IProperties& oLeftProperties, const ant::IProperties& oRightProperties);
312 
320 tResult is_equal(const ant::IProperty& oLeftProperty, const ant::IProperty& oRightProperty);
321 
322 }
323 
325 using ant::IPropertyValue;
326 using ant::IProperties;
327 using ant::IProperty;
328 using spider::is_equal;
329 
330 } //namespace base
331 } //namespace adtf
Copyright © Audi Electronics Venture GmbH.
#define ADTF3_DEPRECATED(_depr_message_)
Mark a function or variable as deprecated.
Copyright © Audi Electronics Venture GmbH.
Defintion of a property set container interface.
virtual bool Exists(const char *strName) const =0
Checks if property exists by name.
ADTF_IID(IProperties, "properties.ant.base.adtf.iid")
iid defintion for IProperties
virtual tResult GetProperty(const char *strName, IProperty &pProperty) const =0
Find a property and set the content to the pProperty.
virtual tResult Set(const IProperties &pProperties)=0
The Set method should copy the the content of pProperties to the property store of this.
~IProperties()=default
Protected destructor.
virtual size_t GetSize() const =0
Return the current size (count of properties) within the store.
virtual tResult Get(IProperties &pProperties) const =0
The Get method will copy the the content of current property store to the given pProperties.
The IProperty interface provides methods for getting and setting property values, name of the propert...
virtual tResult AttachProperties(const ucom::ant::iobject_ptr< IProperties > &pProperties)=0
virtual tResult SetProperties(const IProperties &pProperties)=0
will copy given properties
virtual tResult DetachProperties()=0
virtual tResult GetAttachedProperties(IProperty &pProperty) const =0
virtual tResult GetProperties(ucom::ant::iobject_ptr< IProperties > &pSubProperties)=0
get subproperties for writing access
Observer Interface to react on property changes.
virtual void Notify(const IProperty &oProperty)=0
Implements the observer pattern.
~IPropertyObserver()=default
Protected destructor.
The IPropertyValue interface provides methods for getting and setting property values.
Definition: property_intf.h:61
virtual tResult FromString(const IString &strValueAsString)=0
Implement to deserialize the value from a textfile and/or to set by string.
virtual tResult Set(const IPropertyValue &oValue)=0
Sets the value by a deep copy.
virtual tResult ToString(IString &&strIToString) const =0
Implement to serialize the value to a textfile and/or to show it on a display.
virtual tResult GetType(IString &&strType) const =0
Retrieves the string for the property value type.
The IRawMemory interface provides methods for getting and setting memory values through abstract inte...
The IRawValue interface provides methods for getting and setting raw values.
Definition: property_intf.h:26
virtual tResult ToRaw(IRawMemory &&oRawValue) const =0
Implement to create a fast value copy in memory.
virtual ~IRawValue()=default
protected DTOR
virtual tResult FromRaw(const IRawMemory &oRawValue)=0
Implement to create a fast value copy in memory.
The IString interface provides methods for getting and setting strings through abstract interfaces.
Definition: string_intf.h:28
Base class for every interface type within the uCOM.
Definition: object_intf.h:33
bool operator==(const IProperty &oPropertyLeft, const IProperty &oPropertyRight)
The equality operator returns true only if the given oPropertyLeft is the same as oPropertyRight.
bool operator!=(const IProperty &oPropertyLeft, const IProperty &oPropertyRight)
The not-equality operator returns false only if the given oPropertyLeft is exact the same as oPropert...
tResult is_equal(const ant::IProperties &oLeftProperties, const ant::IProperties &oRightProperties)
Check if two property sets are equal.
tResult is_equal(const ant::IProperty &oLeftProperty, const ant::IProperty &oRightProperty)
Check if two properties are equal.
ant::iobject_ptr< T > iobject_ptr
Alias always bringing the latest version of ant::iobject_ptr into scope.
Namespace for entire ADTF SDK.
Copyright © Audi Electronics Venture GmbH.
Copyright © Audi Electronics Venture GmbH.