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 
12 namespace adtf
13 {
14 namespace base
15 {
16 namespace ant
17 {
18 
24  class IRawValue
25  {
26  protected:
28  virtual ~IRawValue() = default;
29 
30  public:
41  virtual tResult FromRaw(const IRawMemory& oRawValue) = 0;
51  virtual tResult ToRaw(IRawMemory&& oRawValue) const = 0;
52  };
59  class IPropertyValue : public IRawValue
60  {
61  public:
62  ~IPropertyValue() = default;
63 
64  public:
76  virtual tResult GetType(IString&& strType) const = 0;
85  virtual tResult Set(const IPropertyValue& oValue) = 0;
94  virtual tResult FromString(const IString& strValueAsString) = 0;
95 
104  virtual tResult ToString(IString&& strIToString) const = 0;
105  };
106 
107  class IProperties;
108 
117  class IProperty
118  {
119  public:
120  virtual ~IProperty() = default;
121 
122  public:
123  virtual const IPropertyValue* GetValue() const = 0;
124  virtual IPropertyValue* GetValue() = 0;
125  virtual tResult SetValue(const IPropertyValue& oValue) = 0;
126 
127  virtual tResult GetName(IString&& strName) const = 0;
128  virtual tResult SetName(const IString& strName) = 0;
129 
130  virtual tResult Set(const IProperty& oProp) = 0;
131 
132  virtual bool HasProperties() const = 0;
133  virtual bool HasAttachedProperties() const = 0;
134 
136  virtual tResult SetProperties(const IProperties& pProperties) = 0;
137  virtual tResult AttachProperties(const ucom::ant::iobject_ptr<IProperties>& pProperties) = 0;
138  virtual tResult GetAttachedProperties(IProperty& pProperty) const = 0;
139  virtual tResult DetachProperties() = 0;
140 
145  };
146 
156  bool operator==(const IProperty& oPropertyLeft, const IProperty& oPropertyRight);
157 
167  bool operator!=(const IProperty& oPropertyLeft, const IProperty& oPropertyRight);
168 
174  {
175  protected:
177  ~IPropertyObserver() = default;
178  public:
185  virtual void Notify(const IProperty& oProperty) = 0;
186  };
187 
197  {
198  public:
200  ADTF_IID(IProperties, "properties.ant.base.adtf.iid");
201 
202  protected:
204  ~IProperties() = default;
205 
206  public:
211  virtual bool Exists(const char* strName) const = 0;
212 
219  virtual tResult Get(IProperties& pProperties) const = 0;
220 
227  virtual tResult Set(const IProperties& pProperties) = 0;
228 
236  virtual size_t GetSize() const = 0;
237 
248  virtual tResult GetProperty(const char* strName, IProperty& pProperty) const = 0;
249  virtual tResult SetProperty(const IProperty& pProperty) = 0;
250  virtual tResult SetPropertyByPath(const char* strParentPath, const IProperty& pProperty) = 0;
251 
252  virtual tResult RemoveProperty(const char* strName) = 0;
253 
254  virtual tResult RegisterPropertyObserver(const char* strPropertyName,
255  IPropertyObserver& oObserver) = 0;
256  virtual tResult UnregisterPropertyObserver(IPropertyObserver& oObserver) = 0;
257  };
258 
269  bool operator==(const IProperties& oPropertiesLeft, const IProperties& oPropertiesRight);
270 
281  bool operator!=(const IProperties& oPropertiesLeft, const IProperties& oPropertiesRight);
282 
283 } //namespace ant
284 
285 namespace spider
286 {
287 
295 tResult is_equal(const ant::IProperties& oLeftProperties, const ant::IProperties& oRightProperties);
296 
304 tResult is_equal(const ant::IProperty& oLeftProperty, const ant::IProperty& oRightProperty);
305 
306 }
307 
309 using ant::IPropertyValue;
310 using ant::IProperties;
311 using ant::IProperty;
312 using spider::is_equal;
313 
314 } //namespace base
315 } //namespace adtf
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 SetProperties(const IProperties &pProperties)=0
will copy given properties
virtual tResult GetProperties(ucom::ant::iobject_ptr< const IProperties > &pProperties) const =0
get subproperties for readonly access
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:60
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:25
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:31
Base object pointer to realize binary compatible reference counting in interface methods.
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.
Namespace for entire ADTF SDK.
Copyright © Audi Electronics Venture GmbH.
Copyright © Audi Electronics Venture GmbH.