32 constexpr static const char*
const TYPE_NAME =
"attached_config";
33 typedef property_type_conversion_nothing <property_attached_configuration_type> con_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();
144 return base_type::GetValue() == oVal;
149 return base_type::GetValue() != oVal;
187 tResult Set(
const IProperty& )
override
198 template <
typename Interface = IConfiguration>
221 pProperties.
Reset(pConstProps);
231 pProperties.
Reset(pProps);
235 tResult AttachConfiguration(
const char* strName,
240 adtf_util::cString strConfigName(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>
280 return oDefaultValue;
291 template<
typename VALUETYPE>
306 template<
typename VALUETYPE>
335template <
typename VALUETYPE>
336tResult set_property_by_path(IConfiguration& oConfiguration,
const char* strPathAndName, VALUETYPE oValue)
340 return set_property_by_path<VALUETYPE>(*pProperties, strPathAndName, oValue);
343template <
typename VALUETYPE>
344VALUETYPE 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);
354template <
typename VALUETYPE>
355VALUETYPE 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";
446template <
typename U,
typename Enable =
void>
453 static const type& assign(
const type& value)
462 typedef typename std::underlying_type<U>::type type;
463 static type assign(
const U& value)
465 return static_cast<type
>(value);
469template <
typename T,
typename ValueType>
471 const std::vector<std::pair<ValueType, std::string>>& oValueList,
472 bool bRestrictToValues =
true)
475 detail::tReservedProperties::strValueListCount,
476 static_cast<unsigned int>(oValueList.size()));
478 detail::tReservedProperties::strValueListRestricted,
482 for (
const auto& oValue: oValueList)
485 util::cString::Format(detail::tReservedProperties::strValueListValueFormat, nIndex),
488 util::cString::Format(detail::tReservedProperties::strValueListNameFormat, nIndex),
489 oValue.second.c_str());
495void set_valid_range(
IProperties& oSubProperties,
const T& xMin,
const T& xMax)
498 detail::tReservedProperties::strRangeMin,
501 detail::tReservedProperties::strRangeMax,
593 class cImplementation;
594 std::unique_ptr<cImplementation> m_pImplementation;
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();
654 return GetReference() == 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);
677 void SetValueList(
const std::vector<std::pair<T, std::string>>& oValueList, {
…}
699 const T& GetReference()
const
701 return reinterpret_cast<const T&
>(m_oValue.GetValue());
710template<
typename Interface>
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,
763 giant::property_variable<T>::operator=(oVal);
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";
811using catwo::set_property_by_path;
812using 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.
A_UTILS_NS::cResult tResult
For backwards compatibility and to bring latest version into scope.
#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.
tBool operator!=(const tErrorCode &lhs, const tErrorCode &rhs)
Compare two POD error code types for inequality.
tBool operator==(const tErrorCode &lhs, const tErrorCode &rhs)
Compare two POD error code types for equality.
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.
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.
const IPropertyValue * GetValue() const override
tResult GetType(IString &&strType) const override
Returns the identifier of the type.
property_value< T > base_type
internal base type
property_variable(const T &oValue)
type initializing CTOR
Property property implementation template.
cConfiguration()
Default constructor.
Implementation helper template to enriches an implementation with the default implementation of IConf...
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.
cPropertyVariable & operator=(const cPropertyVariable &oOther)
Assignment operator.
cPropertyVariable()
The default constructor.
void SetDescription(const char *strDescription)
Sets the description text associated with the Property.
~cPropertyVariable() override
Destructor.
void SetFilenameOpenForWriting(bool bWriteMode)
Sets the write mode for the file property.
ant::IProperties & GetSubProperties()
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.
const ant::IProperties & GetSubProperties() const
cPropertyVariable & operator=(cPropertyVariable &&oOther)
Move 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.
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.
void SetValueList(const std::vector< std::pair< T, std::string > > &oValueList, bool bRestrictToValues=true)
Sets a value list, that the user can choose from.
const IPropertyValue * GetValue() const override
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.
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.
Use this template if you want to implement an ucom::ant::IObject based Interface and/or subclass an e...
Copyright © Audi Electronics Venture GmbH.
Namespace for all internally used functionality implemented.
Namespace for all functionality of the ADTF Base SDK provided since v3.0.
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.
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 create_property_tree(ant::IProperties &oProperties, const char *strPath)
Creates a property tree structure.
Namespace for all functionality of the ADTF Base SDK provided since v3.5.
Namespace for all internally used functionality implemented.
Namespace for all functionality of the ADTF Base SDK provided since v3.6.
Namespace for all functionality of the ADTF Base SDK provided since v3.7.
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 the ADTF Base SDK.
tResult set_property(IConfiguration &oConfiguration, const char *strNameOfValue, VALUETYPE oValue)
Set the property.
object_ptr< Implementation > make_object_ptr(Args &&... args)
Alias always bringing the latest version of ant::make_object_ptr() into scope.
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.