53 bool Exists(
const char* strName)
const override;
54 tResult Get(
IProperties& pProperties)
const override;
55 tResult Set(
const IProperties& pProperties)
override;
57 size_t GetSize()
const override;
59 tResult GetProperty(
const char* strName,
IProperty& pProperty)
const override;
60 tResult SetProperty(
const IProperty& pProperty)
override;
61 tResult SetPropertyByPath(
const char* strParentPath,
const IProperty& pProperty)
override;
63 tResult RemoveProperty(
const char* strName)
override;
74 tResult RegisterPropertyObserver(
const char* strPropertyName,
IPropertyObserver& oObserver);
126 bool Exists(
const char* )
const override
131 tResult GetProperty(
const char* ,
IProperty& )
const override
133 RETURN_ERROR(ERR_NOT_IMPL);
137 tResult SetProperty(
const IProperty& ) = 0;
139 tResult SetPropertyByPath(
const char* ,
const IProperty& )
override
141 RETURN_ERROR(ERR_NOT_IMPL);
146 RETURN_ERROR(ERR_NOT_IMPL);
151 RETURN_ERROR(ERR_NOT_IMPL);
154 size_t GetSize()
const override
159 tResult RemoveProperty(
const char* )
override
161 RETURN_ERROR(ERR_NOT_IMPL);
164 tResult RegisterPropertyObserver(
const char* ,
167 RETURN_ERROR(ERR_NOT_IMPL);
172 RETURN_ERROR(ERR_NOT_IMPL);
189 template<
typename VALUETYPE>
190 tResult set_property(
IProperties& oProperties,
const char* strNameOfValue, VALUETYPE oValue)
207 inline tResult set_property(
IProperties& oProperties,
const char* strNameOfValue,
const char* poValue)
209 return set_property<adtf_util::cString>(oProperties, strNameOfValue, adtf_util::cString(poValue));
224 template<
typename VALUETYPE>
225 VALUETYPE get_property(
const IProperties& oProperties,
const char* strNameOfValue, VALUETYPE oDefaultValue)
228 if (oProperties.
Exists(strNameOfValue))
246 template<
typename VALUETYPE>
247 VALUETYPE get_property(
const IProperties& oProperties,
const char* strNameOfValue)
249 return get_property<VALUETYPE>(oProperties, strNameOfValue, VALUETYPE());
270 template <
typename VALUETYPE>
271 tResult set_property_by_path(
IProperties& oProperties,
const char* strPathAndName, VALUETYPE oValue)
273 util::cString strHelper(strPathAndName);
274 size_t nLastSlashPosition = strHelper.RFind(
'/');
275 if (nLastSlashPosition == util::cString::InvalidPos)
277 return ant::set_property<VALUETYPE>(oProperties, strPathAndName, oValue);
280 util::cString strParent = strHelper.Mid(0, nLastSlashPosition);
281 return oProperties.SetPropertyByPath(strParent, property<VALUETYPE>(strHelper.Mid(nLastSlashPosition + 1), oValue));
284 template <
typename VALUETYPE>
285 VALUETYPE get_property_by_path(
const IProperties& oProperties,
const char* strPathAndName, VALUETYPE oDefaultValue)
287 property<VALUETYPE> oProperty;
288 if (IS_FAILED(hollow::get_property_object_by_path(oProperties, strPathAndName, oProperty)))
290 return oDefaultValue;
293 return oProperty.GetValueT();
296 template <
typename VALUETYPE>
297 VALUETYPE get_property_by_path(
const IProperties& oProperties,
const char* strPathAndName)
299 return get_property_by_path(oProperties, strPathAndName, VALUETYPE());
331 template <
typename PropertyType>
332 void call_callback(
const ant::IProperty& oProperty, std::function<
void(
const char*, PropertyType)> fnCallback)
337 oValue.
Set(*oProperty.GetValue());
338 fnCallback(strName.c_str(), oValue.GetValue());
343 using tPropertyVisitorCallback = std::function<void(
const ant::IProperty& oProperty)>;
351 tPropertyVisitorCallback fnCallback);
359 template <
typename SubPropertyType>
361 std::function<
void(
const char*, SubPropertyType)> fnCallback)
363 visit_properties(oProperties, std::bind(detail::call_callback<SubPropertyType>, std::placeholders::_1, fnCallback));
372 tPropertyVisitorCallback fnCallback);
380 template <
typename SubPropertyType>
382 std::function<
void(
const char*, SubPropertyType)> fnCallback)
384 visit_sub_properties(oProperty, std::bind(detail::call_callback<SubPropertyType>, std::placeholders::_1, fnCallback));
394 const char* strPropertyName,
395 tPropertyVisitorCallback fnCallback);
404 template <
typename SubPropertyType>
406 const char* strPropertyName,
407 std::function<
void(
const char*, SubPropertyType)> fnCallback)
411 std::bind(detail::call_callback<SubPropertyType>, std::placeholders::_1, fnCallback));
416 using ant::cPropertiesHelper;
417 using ant::set_property;
418 using ant::get_property;
419 using ant::cProperties;
420 using catwo::set_property_by_path;
421 using catwo::get_property_by_path;
422 using hollow::get_property_object_by_path;
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.
virtual tResult GetProperty(const char *strName, IProperty &pProperty) const =0
Find a property and set the content to the pProperty.
The IProperty interface provides methods for getting and setting property values, name of the propert...
Observer Interface to react on property changes.
The IPropertyValue interface provides methods for getting and setting property values.
Base class for basic implementation of a IProperties interface.
cPropertiesBase(const cPropertiesBase &oPropy)
copy CTOR
cPropertiesBase & operator=(const cPropertiesBase &oPropy)
copy assignment
cPropertiesBase & operator=(cPropertiesBase &&oPropy)=delete
no move
cPropertiesBase(cPropertiesBase &&oPropy)=delete
no move
cPropertiesBase & operator=(const IProperties &oIPropy)
copy asignment
bool IsEqual(const IProperties &oProperties) const
compares the content of the current storage with the given oProperties
cPropertiesBase & CreateProperty(const char *strName, const ant::IPropertyValue &oValue)
Adds a new property and returns a reference to the sub-properties object.
cPropertiesBase(const IProperties &oIPropy)
copy CTOR tfrom interface value
A_UTILS_D(cPropertiesBase)
dptr impl
virtual ~cPropertiesBase()
DTOR.
Property Store as IObject.
cProperties & operator=(const cProperties &oPropy)
assinment operator
cProperties(const IProperties &oIPropy)
copy CTOR
virtual ~cProperties()
DTOR.
cProperties(cProperties &&oPropy)=delete
no move
cProperties(const cProperties &oPropy)
copy CTOR
cProperties & operator=(cProperties &&oPropy)=delete
no move
cProperties & operator=(const IProperties &oIPropy)
assinment operator
tResult Set(const IPropertyValue &oValue)
Sets the value by a deep copy.
Property property implementation template.
T GetValueT() const
Get the containing value.
Use this template if you want to implement an ucom::ant::IObject based Interface and/or subclass an e...
tResult create_property_tree(ant::IProperties &oProperties, const char *strPath)
Creates a property tree structure.
std::pair< std::string, std::string > split_parents_and_leaf(const char *strPropertyPathAndName)
Splits a property path into the parent path and the property name.
void visit_sub_properties(const ant::IProperty &oProperty, tPropertyVisitorCallback fnCallback)
Utility function to visit all sub-properties of a given property.
void visit_properties(const ant::IProperties &oProperties, tPropertyVisitorCallback fnCallback)
Utility function to visit all properties of a properties object.
Namespace for entire ADTF SDK.
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.