32 constexpr
static const char*
const TYPE_NAME =
"attached_config";
41 typedef ::adtf::base::ant::property_attached_configuration_type
value_type;
43 typedef ::adtf::base::ant::property<::adtf::base::ant::property_attached_configuration_type>
base_type;
57 class cPropertyVariable;
132 const T& operator*()
const
134 return base_type::GetValue();
137 operator const T&()
const
139 return base_type::GetValue();
142 bool operator==(
const T& oVal)
144 return base_type::GetValue() == oVal;
147 bool operator!=(
const T& oVal)
149 return base_type::GetValue() != oVal;
187 tResult Set(
const IProperty& )
override
198 template <
typename Interface = IConfiguration>
209 m_pProperties = adtf::ucom::make_object_ptr<spider::cProperties>();
221 pProperties.
Reset(pConstProps);
231 pProperties.
Reset(pProps);
235 tResult AttachConfiguration(
const char* strName,
246 tResult DetachConfiguration(
const char* strName)
override
252 tResult RegisterPropertyVariable(
const char* strName,
253 cPropertyVariable& oPropertyVariable);
255 tResult UnregisterPropertyVariable(cPropertyVariable& oPropertyVariable)
257 return m_pProperties->UnregisterPropertyObserver(oPropertyVariable);
270 template<
typename VALUETYPE>
276 return get_property<VALUETYPE>(*pProperties, strNameOfValue, oDefaultValue);
280 return oDefaultValue;
291 template<
typename VALUETYPE>
294 return get_property<VALUETYPE>(oConfiguration, strNameOfValue, VALUETYPE());
306 template<
typename VALUETYPE>
311 return set_property<VALUETYPE>(*pProperties, strNameOfValue, oValue);
326 return set_property<adtf_util::cString>(*pProperties, strNameOfValue,
adtf_util::cString(poValue));
335 template <
typename VALUETYPE>
336 tResult set_property_by_path(IConfiguration& oConfiguration,
const char* strPathAndName, VALUETYPE oValue)
340 return set_property_by_path<VALUETYPE>(*pProperties, strPathAndName, oValue);
343 template <
typename VALUETYPE>
344 VALUETYPE get_property_by_path(
const IConfiguration& oConfiguration,
const char* strPathAndName, VALUETYPE oDefaultValue)
347 if (
IS_FAILED(oConfiguration.GetProperties(pProperties)))
349 return oDefaultValue;
351 return get_property_by_path<VALUETYPE>(*pProperties, strPathAndName, oDefaultValue);
354 template <
typename VALUETYPE>
355 VALUETYPE get_property_by_path(
const IConfiguration& oConfiguration,
const char* strPathAndName)
357 return get_property_by_path(oConfiguration, strPathAndName, VALUETYPE());
396 class cImplementation;
397 std::unique_ptr<cImplementation> m_pImplementation;
410 const T* operator->()
412 return &
static_cast<const T&
>(*this);
426 static constexpr
const char*
const strReservedPrefix =
"#__";
427 static constexpr
const char*
const strDisplayName =
"#__display_name";
428 static constexpr
const char*
const strDescription =
"#__description";
429 static constexpr
const char*
const strRangeMin =
"#__range_min";
430 static constexpr
const char*
const strRangeMax =
"#__range_max";
431 static constexpr
const char*
const strValueListCount =
"#__value_list_count";
432 static constexpr
const char*
const strValueListValueFormat =
"#__value_list_value_%zu";
433 static constexpr
const char*
const strValueListNameFormat =
"#__value_list_name_%zu";
434 static constexpr
const char*
const strValueListRestricted =
"#__value_list_restricted";
435 static constexpr
const char*
const strEditorListCount =
"#__editor_list_count";
436 static constexpr
const char*
const strEditorListNameFormat =
"#__editor_list_name_%zu";
437 static constexpr
const char*
const strEditorListUrlFormat =
"#__editor_list_url_%zu";
438 static constexpr
const char*
const strServiceDefaultRunlevel =
"#__service_default_runlevel";
439 static constexpr
const char*
const strFilenameExtensionFilter =
"#__filename_extension_filter";
440 static constexpr
const char*
const strFilenameOpenForWriting =
"#__filename_open_for_writing";
441 static constexpr
const char*
const strHelpLink =
"#__help_link";
442 static constexpr
const char*
const strItemDescriptions =
"#__item_descriptions";
443 static constexpr
const char*
const strResolveMacros =
"#__resolve_macros";
446 template <
typename U,
typename Enable =
void>
453 static const type& assign(
const type& value)
459 template <
typename U>
462 typedef typename std::underlying_type<U>::type type;
463 static type assign(
const U& value)
465 return static_cast<type
>(value);
469 template <
typename T,
typename ValueType>
471 const std::vector<std::pair<ValueType, std::string>>& oValueList,
472 bool bRestrictToValues =
true)
474 set_property<unsigned int>(oSubProperties,
475 detail::tReservedProperties::strValueListCount,
476 static_cast<unsigned int>(oValueList.size()));
477 set_property<bool>(oSubProperties,
478 detail::tReservedProperties::strValueListRestricted,
482 for (
const auto& oValue: oValueList)
484 set_property<T>(oSubProperties,
485 util::cString::Format(detail::tReservedProperties::strValueListValueFormat, nIndex),
487 set_property<util::cString>(oSubProperties,
488 util::cString::Format(detail::tReservedProperties::strValueListNameFormat, nIndex),
489 oValue.second.c_str());
494 template <
typename T>
495 void set_valid_range(
IProperties& oSubProperties,
const T& xMin,
const T& xMax)
497 set_property<T>(oSubProperties,
498 detail::tReservedProperties::strRangeMin,
500 set_property<T>(oSubProperties,
501 detail::tReservedProperties::strRangeMax,
593 class cImplementation;
594 std::unique_ptr<cImplementation> m_pImplementation;
600 template <
typename T>
617 m_oValue(giant::detail::storage_type<T>::assign(xValue))
629 m_oValue.
Set(*oProperty.GetValue());
634 return m_oValue.
GetType(std::forward<IString>(strType));
642 const T& operator*()
const
644 return GetReference();
647 operator const T&()
const
649 return GetReference();
652 bool operator==(
const T& oVal)
654 return GetReference() == oVal;
657 bool operator!=(
const T& oVal)
659 return GetReference() != oVal;
662 const T* operator->()
664 return &GetReference();
667 const T* operator->()
const
669 return &GetReference();
677 void SetValueList(
const std::vector<std::pair<T, std::string>>& oValueList,
678 bool bRestrictToValues =
true)
680 detail::set_value_list<property_type>(
GetSubProperties(), oValueList, bRestrictToValues);
699 const T& GetReference()
const
701 return reinterpret_cast<const T&
>(m_oValue.GetValue());
710 template<
typename Interface>
711 tResult configuration<Interface>::RegisterPropertyVariable(
const char* strName, cPropertyVariable& oPropertyVariable)
714 detail::cPropertyVariableHelper oHelper(oParentsAndName.second.c_str(), *oPropertyVariable.GetValue());
718 const auto& oGiantPropertyVariable =
dynamic_cast<const giant::cPropertyVariable&
>(oPropertyVariable);
719 RETURN_IF_FAILED(oHelper.SetProperties(oGiantPropertyVariable.GetSubProperties()));
726 RETURN_IF_FAILED(m_pProperties->SetPropertyByPath(oParentsAndName.first.c_str(), oHelper));
727 RETURN_IF_FAILED(m_pProperties->RegisterPropertyObserver(strName, oPropertyVariable));
728 oPropertyVariable.SetUnregister(*
this);
746 const char* strPropertyPathAndName,
753 template <
typename T>
773 m_fnPropertyChangedCallback = fnCallback;
780 if (m_fnPropertyChangedCallback)
782 m_fnPropertyChangedCallback();
787 std::function<void()> m_fnPropertyChangedCallback;
798 static constexpr
const char*
const strRuntimeNode =
"#__runtime";
799 static constexpr
const char*
const strRuntimeStartOnStartup =
"#__runtime/start_on_startup";
811 using catwo::set_property_by_path;
812 using catwo::get_property_by_path;
void tVoid
The tVoid is always the definition for the void (non-type).
bool tBool
The tBool defines the type for the Values tTrue and tFalse (platform and compiler dependent).
#define IS_FAILED(s)
Check if result is failed.
#define RETURN_IF_FAILED(s)
Return if expression is failed, which requires the calling function's return type to be tResult.
#define RETURN_NOERROR
Return status ERR_NOERROR, which requires the calling function's return type to be tResult.
#define RETURN_ERROR(code)
Return specific error code, which requires the calling function's return type to be tResult.
#define IS_OK(s)
Check if result is OK.
A common result class usable as return value throughout.
ucom Interface to a objects configuration.
virtual tResult GetProperties(ucom::ant::iobject_ptr< const IProperties > &pProperties) const =0
Gets the properties with read access.
Defintion of a property set container interface.
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.
The IString interface provides methods for getting and setting strings through abstract interfaces.
tResult AttachProperties(const ucom::ant::iobject_ptr< IProperties > &pAttachedProperties) override
will set given properties to be attached
Default implemementation of a property_variable.
virtual const IPropertyValue * GetValue() const =0
virtual tResult GetType(IString &&strType) const =0
Returns the identifier of the type.
Implementation helper template to enriches an implementation with the default implementation of IConf...
virtual ~configuration()=default
DTOR.
adtf::ucom::object_ptr< spider::cProperties > m_pProperties
the current runtiem property set
tResult GetProperties(adtf::ucom::ant::iobject_ptr< const IProperties > &pProperties) const override
Gets the configuration with only read access.
tResult GetProperties(adtf::ucom::ant::iobject_ptr< IProperties > &pProperties) override
Gets the properties of configuration with only read/write access.
Internal class helper to wrap e property variable for the SetProperty call without copy.
cPropertyVariableHelper(const adtf_util::cString &strName, const IPropertyValue &oValue)
CTOR initializer.
cRefConfigProperty(const adtf_util::cString &strConfigurationName, ucom::ant::iobject_ptr< IProperties > &pPropertiesAttach)
initializer CTOR
::adtf::base::ant::property<::adtf::base::ant::property_attached_configuration_type > base_type
internal base type
::adtf::base::ant::property_attached_configuration_type value_type
internal value type
tResult Set(const IPropertyValue &oValue)
Sets the value by a deep copy.
tResult GetType(IString &&strType) const
Retrieves the string for the property value type.
Property Variable template for the given T.
void Notify(const IProperty &oProperty) override
Implements the observer pattern.
tResult GetType(IString &&strType) const override
Returns the identifier of the type.
property_variable(const T &oValue)
type initializing CTOR
const IPropertyValue * GetValue() const override
Property property implementation template.
Implements all functionality required by ant::IConfiguration.
cConfiguration()
Default constructor.
tResult GetProperties(adtf::ucom::ant::iobject_ptr< IProperties > &pProperties)
Gets the properties with read access.
tResult AttachConfiguration(const char *strName, IConfiguration &oAttachedConfiguration)
Attaches the given configuration and its properties as property tree item of this.
tResult DetachConfiguration(const char *strName)
Detaches a configuration with the specified name.
tResult GetProperties(adtf::ucom::ant::iobject_ptr< const IProperties > &pProperties) const
Gets the properties with read access.
tResult RegisterPropertyVariable(const char *strName, ant::cPropertyVariable &oPropertyVariable)
Registers a property variable that always reflects the current value of the property.
virtual ~cConfiguration()
Destructor.
Property Variable template for the given T.
Base class for property_variable.
cPropertyVariable()
The default constructor.
void SetDescription(const char *strDescription)
Sets the description text associated with the Property.
~cPropertyVariable() override
Destructor.
ant::IProperties & GetSubProperties()
void SetFilenameOpenForWriting(bool bWriteMode)
Sets the write mode for the file property.
tVoid SetResolveMacros(tBool bResolveMacros)
Sets whether or not macros should be resolved by the session manager or not.
cPropertyVariable(const cPropertyVariable &oOther)
Copy constructor.
void SetDisplayName(const char *strDisplayName)
Sets the name that tools should display.
cPropertyVariable & operator=(cPropertyVariable &&oOther)
Move assignment operator.
cPropertyVariable & operator=(const cPropertyVariable &oOther)
Assignment operator.
void SetFilenameExtensionFilter(const char *strFilenameExtensionFilter)
Sets optional file filters for Configuration Editor FileDialogs of cFilename and cFilenameList proper...
cPropertyVariable(cPropertyVariable &&oOther)
Move constructor.
const ant::IProperties & GetSubProperties() const
Property Variable template for the given T.
property_variable(const T &xValue)
Initializes the property variable with the given value.
void Notify(const IProperty &oProperty) override
Implements the observer pattern.
property_variable()=default
Initializes the property variable with the default value of T.
tResult GetType(IString &&strType) const override
Returns the identifier of the type.
void SetValidRange(const T &xMin, const T &xMax)
Sets the valid range of values.
const IPropertyValue * GetValue() const override
void SetValueList(const std::vector< std::pair< T, std::string >> &oValueList, bool bRestrictToValues=true)
Sets a value list, that the user can choose from.
Property Variable template for the given T.
void Notify(const IProperty &oProperty) override
Implements the observer pattern.
void SetPropertyChangedCallback(const std::function< void()> &fnCallback)
Set a callback to get notified about property changes.
property_variable & operator=(const T &oVal)
Assignment operator.
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.
Object pointer implementation used for reference counting on objects of type IObject.
Use this template if you want to implement an ucom::ant::IObject based Interface and/or subclass an e...
Copyright © Audi Electronics Venture GmbH.
string_base< cStackString > cString
cString implementation for a stack string which works on stack if string is lower than A_UTILS_DEFAUL...
VALUETYPE get_property(const IConfiguration &oConfiguration, const char *strNameOfValue, VALUETYPE oDefaultValue)
Get the property content converted to the VALUETYPE.
tResult set_property(IConfiguration &oConfiguration, const char *strNameOfValue, VALUETYPE oValue)
Set the property.
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.
tResult get_property_object_by_path(const ant::IConfiguration &oConfiguration, const char *strPropertyPathAndName, ant::IProperty &oProperty)
Retrieves a property reference under the given oConfiguration by path.
Namespace for entire ADTF SDK.
Copyright © Audi Electronics Venture GmbH.
Copyright © Audi Electronics Venture GmbH.
Concept template to define the Name and the conversion type for the given type TYPE.