diff options
Diffstat (limited to 'parameter')
-rw-r--r-- | parameter/Android.mk | 1 | ||||
-rw-r--r-- | parameter/ElementBuilder.cpp | 38 | ||||
-rw-r--r-- | parameter/ElementBuilder.h | 7 | ||||
-rw-r--r-- | parameter/ElementBuilderTemplate.h | 1 | ||||
-rw-r--r-- | parameter/ElementLibrary.cpp | 4 | ||||
-rw-r--r-- | parameter/ElementLibrary.h | 16 | ||||
-rw-r--r-- | parameter/KindElementBuilderTemplate.h | 2 | ||||
-rw-r--r-- | parameter/NamedElementBuilderTemplate.h | 2 | ||||
-rw-r--r-- | parameter/ParameterMgr.cpp | 50 | ||||
-rw-r--r-- | parameter/SubsystemElementBuilder.cpp | 3 | ||||
-rw-r--r-- | parameter/SystemClass.cpp | 3 |
11 files changed, 45 insertions, 82 deletions
diff --git a/parameter/Android.mk b/parameter/Android.mk index e6e9891..a4be419 100644 --- a/parameter/Android.mk +++ b/parameter/Android.mk @@ -16,7 +16,6 @@ common_src_files := \ PathNavigator.cpp \ Element.cpp \ SystemClass.cpp \ - ElementBuilder.cpp \ Component.cpp \ ParameterMgr.cpp \ SelectionCriteria.cpp \ diff --git a/parameter/ElementBuilder.cpp b/parameter/ElementBuilder.cpp deleted file mode 100644 index aa383bc..0000000 --- a/parameter/ElementBuilder.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/* - * INTEL CONFIDENTIAL - * Copyright © 2011 Intel - * Corporation All Rights Reserved. - * - * The source code contained or described herein and all documents related to - * the source code ("Material") are owned by Intel Corporation or its suppliers - * or licensors. Title to the Material remains with Intel Corporation or its - * suppliers and licensors. The Material contains trade secrets and proprietary - * and confidential information of Intel or its suppliers and licensors. The - * Material is protected by worldwide copyright and trade secret laws and - * treaty provisions. No part of the Material may be used, copied, reproduced, - * modified, published, uploaded, posted, transmitted, distributed, or - * disclosed in any way without Intel’s prior express written permission. - * - * No license under any patent, copyright, trade secret or other intellectual - * property right is granted to or conferred upon you by disclosure or delivery - * of the Materials, either expressly, by implication, inducement, estoppel or - * otherwise. Any license under such intellectual property rights must be - * express and approved by Intel in writing. - * - * CREATED: 2011-06-01 - * UPDATED: 2011-07-27 - */ -#include "ElementBuilder.h" - -CElementBuilder::CElementBuilder(const string& strType) : _strType(strType) -{ -} - -CElementBuilder::~CElementBuilder() -{ -} - -const string& CElementBuilder::getType() const -{ - return _strType; -} diff --git a/parameter/ElementBuilder.h b/parameter/ElementBuilder.h index fddcd03..8264721 100644 --- a/parameter/ElementBuilder.h +++ b/parameter/ElementBuilder.h @@ -29,12 +29,7 @@ class CElementBuilder { public: - CElementBuilder(const string& strType); - virtual ~CElementBuilder(); - - const string& getType() const; + virtual ~CElementBuilder() {}; virtual CElement* createElement(const CXmlElement& xmlElement) const = 0; -private: - string _strType; }; diff --git a/parameter/ElementBuilderTemplate.h b/parameter/ElementBuilderTemplate.h index d74a04f..5b65f23 100644 --- a/parameter/ElementBuilderTemplate.h +++ b/parameter/ElementBuilderTemplate.h @@ -30,7 +30,6 @@ template <class ElementType> class TElementBuilderTemplate : public CElementBuilder { public: - TElementBuilderTemplate(const string& strType) : CElementBuilder(strType) {} virtual CElement* createElement(const CXmlElement& xmlElement) const { diff --git a/parameter/ElementLibrary.cpp b/parameter/ElementLibrary.cpp index 9031d3c..695942a 100644 --- a/parameter/ElementLibrary.cpp +++ b/parameter/ElementLibrary.cpp @@ -57,9 +57,9 @@ CElement* CElementLibrary::createElement(const CXmlElement& xmlElement) const return NULL; } -void CElementLibrary::addElementBuilder(CElementBuilder* pElementBuilder) +void CElementLibrary::addElementBuilder(string type, const CElementBuilder *pElementBuilder) { - _elementBuilderMap[pElementBuilder->getType()] = pElementBuilder; + _elementBuilderMap[type] = pElementBuilder; } string CElementLibrary::getBuilderType(const CXmlElement& xmlElement) const diff --git a/parameter/ElementLibrary.h b/parameter/ElementLibrary.h index 134ef0f..0de6056 100644 --- a/parameter/ElementLibrary.h +++ b/parameter/ElementLibrary.h @@ -35,15 +35,21 @@ class CElementBuilder; class CElementLibrary { - typedef map<string, CElementBuilder*>::iterator ElementBuilderMapIterator; - typedef map<string, CElementBuilder*>::const_iterator ElementBuilderMapConstIterator; + typedef map<string, const CElementBuilder*> ElementBuilderMap; + typedef ElementBuilderMap::iterator ElementBuilderMapIterator; + typedef ElementBuilderMap::const_iterator ElementBuilderMapConstIterator; public: CElementLibrary(); virtual ~CElementLibrary(); - // Filling - void addElementBuilder(CElementBuilder* pElementBuilder); + /** Add a xml tag and it's corresponding builder in the library. + * + * @param[in] xmlTag is the tag of an xml element that can be given to the builder to + * create a new element. + * @param[in] pElementBuilder is the tag associated element builder. + */ + void addElementBuilder(string type, const CElementBuilder *pElementBuilder); void clean(); // Instantiation @@ -54,5 +60,5 @@ private: virtual string getBuilderType(const CXmlElement& xmlElement) const; // Builders - map<string, CElementBuilder*> _elementBuilderMap; + ElementBuilderMap _elementBuilderMap; }; diff --git a/parameter/KindElementBuilderTemplate.h b/parameter/KindElementBuilderTemplate.h index afdd686..2fa8371 100644 --- a/parameter/KindElementBuilderTemplate.h +++ b/parameter/KindElementBuilderTemplate.h @@ -30,7 +30,7 @@ template <class ElementType> class TKindElementBuilderTemplate : public CElementBuilder { public: - TKindElementBuilderTemplate(const string& strType) : CElementBuilder(strType) {} + TKindElementBuilderTemplate() : CElementBuilder() {} virtual CElement* createElement(const CXmlElement& xmlElement) const { diff --git a/parameter/NamedElementBuilderTemplate.h b/parameter/NamedElementBuilderTemplate.h index 7ebb8d8..eaf4320 100644 --- a/parameter/NamedElementBuilderTemplate.h +++ b/parameter/NamedElementBuilderTemplate.h @@ -30,7 +30,7 @@ template <class ElementType> class TNamedElementBuilderTemplate : public CElementBuilder { public: - TNamedElementBuilderTemplate(const string& strType) : CElementBuilder(strType) {} + TNamedElementBuilderTemplate() : CElementBuilder() {} virtual CElement* createElement(const CXmlElement& xmlElement) const { diff --git a/parameter/ParameterMgr.cpp b/parameter/ParameterMgr.cpp index fdca8da..f2d30e2 100644 --- a/parameter/ParameterMgr.cpp +++ b/parameter/ParameterMgr.cpp @@ -2101,43 +2101,43 @@ void CParameterMgr::feedElementLibraries() // Global Configuration handling CElementLibrary* pFrameworkConfigurationLibrary = new CElementLibrary; - pFrameworkConfigurationLibrary->addElementBuilder(new TElementBuilderTemplate<CParameterFrameworkConfiguration>("ParameterFrameworkConfiguration")); - pFrameworkConfigurationLibrary->addElementBuilder(new TKindElementBuilderTemplate<CSubsystemPlugins>("SubsystemPlugins")); - pFrameworkConfigurationLibrary->addElementBuilder(new TKindElementBuilderTemplate<CPluginLocation>("Location")); - pFrameworkConfigurationLibrary->addElementBuilder(new TKindElementBuilderTemplate<CFrameworkConfigurationLocation>("StructureDescriptionFileLocation")); - pFrameworkConfigurationLibrary->addElementBuilder(new TKindElementBuilderTemplate<CFrameworkConfigurationGroup>("SettingsConfiguration")); - pFrameworkConfigurationLibrary->addElementBuilder(new TKindElementBuilderTemplate<CFrameworkConfigurationLocation>("ConfigurableDomainsFileLocation")); - pFrameworkConfigurationLibrary->addElementBuilder(new TKindElementBuilderTemplate<CFrameworkConfigurationLocation>("BinarySettingsFileLocation")); + pFrameworkConfigurationLibrary->addElementBuilder("ParameterFrameworkConfiguration", new TElementBuilderTemplate<CParameterFrameworkConfiguration>()); + pFrameworkConfigurationLibrary->addElementBuilder("SubsystemPlugins", new TKindElementBuilderTemplate<CSubsystemPlugins>()); + pFrameworkConfigurationLibrary->addElementBuilder("Location", new TKindElementBuilderTemplate<CPluginLocation>()); + pFrameworkConfigurationLibrary->addElementBuilder("StructureDescriptionFileLocation", new TKindElementBuilderTemplate<CFrameworkConfigurationLocation>()); + pFrameworkConfigurationLibrary->addElementBuilder("SettingsConfiguration", new TKindElementBuilderTemplate<CFrameworkConfigurationGroup>()); + pFrameworkConfigurationLibrary->addElementBuilder("ConfigurableDomainsFileLocation", new TKindElementBuilderTemplate<CFrameworkConfigurationLocation>()); + pFrameworkConfigurationLibrary->addElementBuilder("BinarySettingsFileLocation", new TKindElementBuilderTemplate<CFrameworkConfigurationLocation>()); _pElementLibrarySet->addElementLibrary(pFrameworkConfigurationLibrary); // Parameter creation CElementLibrary* pParameterCreationLibrary = new CElementLibrary; - pParameterCreationLibrary->addElementBuilder(new CSubsystemElementBuilder(getSystemClass()->getSubsystemLibrary())); - pParameterCreationLibrary->addElementBuilder(new TNamedElementBuilderTemplate<CComponentType>("ComponentType")); - pParameterCreationLibrary->addElementBuilder(new TNamedElementBuilderTemplate<CComponentInstance>("Component")); - pParameterCreationLibrary->addElementBuilder(new TNamedElementBuilderTemplate<CBitParameterType>("BitParameter")); - pParameterCreationLibrary->addElementBuilder(new TNamedElementBuilderTemplate<CBitParameterBlockType>("BitParameterBlock")); - pParameterCreationLibrary->addElementBuilder(new TNamedElementBuilderTemplate<CStringParameterType>("StringParameter")); - pParameterCreationLibrary->addElementBuilder(new TNamedElementBuilderTemplate<CParameterBlockType>("ParameterBlock")); - pParameterCreationLibrary->addElementBuilder(new TNamedElementBuilderTemplate<CBooleanParameterType>("BooleanParameter")); - pParameterCreationLibrary->addElementBuilder(new TNamedElementBuilderTemplate<CIntegerParameterType>("IntegerParameter")); - pParameterCreationLibrary->addElementBuilder(new TElementBuilderTemplate<CLinearParameterAdaptation>("LinearAdaptation")); - pParameterCreationLibrary->addElementBuilder(new TNamedElementBuilderTemplate<CEnumParameterType>("EnumParameter")); - pParameterCreationLibrary->addElementBuilder(new TElementBuilderTemplate<CEnumValuePair>("ValuePair")); - pParameterCreationLibrary->addElementBuilder(new TNamedElementBuilderTemplate<CFixedPointParameterType>("FixedPointParameter")); - pParameterCreationLibrary->addElementBuilder(new TKindElementBuilderTemplate<CXmlFileIncluderElement>("SubsystemInclude")); + pParameterCreationLibrary->addElementBuilder("Subsystem", new CSubsystemElementBuilder(getSystemClass()->getSubsystemLibrary())); + pParameterCreationLibrary->addElementBuilder("ComponentType", new TNamedElementBuilderTemplate<CComponentType>()); + pParameterCreationLibrary->addElementBuilder("Component", new TNamedElementBuilderTemplate<CComponentInstance>()); + pParameterCreationLibrary->addElementBuilder("BitParameter", new TNamedElementBuilderTemplate<CBitParameterType>()); + pParameterCreationLibrary->addElementBuilder("BitParameterBlock", new TNamedElementBuilderTemplate<CBitParameterBlockType>()); + pParameterCreationLibrary->addElementBuilder("StringParameter", new TNamedElementBuilderTemplate<CStringParameterType>()); + pParameterCreationLibrary->addElementBuilder("ParameterBlock", new TNamedElementBuilderTemplate<CParameterBlockType>()); + pParameterCreationLibrary->addElementBuilder("BooleanParameter", new TNamedElementBuilderTemplate<CBooleanParameterType>()); + pParameterCreationLibrary->addElementBuilder("IntegerParameter", new TNamedElementBuilderTemplate<CIntegerParameterType>()); + pParameterCreationLibrary->addElementBuilder("LinearAdaptation", new TElementBuilderTemplate<CLinearParameterAdaptation>()); + pParameterCreationLibrary->addElementBuilder("EnumParameter", new TNamedElementBuilderTemplate<CEnumParameterType>()); + pParameterCreationLibrary->addElementBuilder("ValuePair", new TElementBuilderTemplate<CEnumValuePair>()); + pParameterCreationLibrary->addElementBuilder("FixedPointParameter", new TNamedElementBuilderTemplate<CFixedPointParameterType>()); + pParameterCreationLibrary->addElementBuilder("SubsystemInclude", new TKindElementBuilderTemplate<CXmlFileIncluderElement>()); _pElementLibrarySet->addElementLibrary(pParameterCreationLibrary); // Parameter Configuration Domains creation CElementLibrary* pParameterConfigurationLibrary = new CElementLibrary; - pParameterConfigurationLibrary->addElementBuilder(new TNamedElementBuilderTemplate<CConfigurableDomain>("ConfigurableDomain")); - pParameterConfigurationLibrary->addElementBuilder(new TNamedElementBuilderTemplate<CDomainConfiguration>("Configuration")); - pParameterConfigurationLibrary->addElementBuilder(new TElementBuilderTemplate<CCompoundRule>("CompoundRule")); - pParameterConfigurationLibrary->addElementBuilder(new TElementBuilderTemplate<CSelectionCriterionRule>("SelectionCriterionRule")); + pParameterConfigurationLibrary->addElementBuilder("ConfigurableDomain", new TNamedElementBuilderTemplate<CConfigurableDomain>()); + pParameterConfigurationLibrary->addElementBuilder("Configuration", new TNamedElementBuilderTemplate<CDomainConfiguration>()); + pParameterConfigurationLibrary->addElementBuilder("CompoundRule", new TElementBuilderTemplate<CCompoundRule>()); + pParameterConfigurationLibrary->addElementBuilder("SelectionCriterionRule", new TElementBuilderTemplate<CSelectionCriterionRule>()); _pElementLibrarySet->addElementLibrary(pParameterConfigurationLibrary); } diff --git a/parameter/SubsystemElementBuilder.cpp b/parameter/SubsystemElementBuilder.cpp index c55c7dc..6336778 100644 --- a/parameter/SubsystemElementBuilder.cpp +++ b/parameter/SubsystemElementBuilder.cpp @@ -25,7 +25,8 @@ #include "SubsystemElementBuilder.h" #include "SubsystemLibrary.h" -CSubsystemElementBuilder::CSubsystemElementBuilder(const CSubsystemLibrary* pSubsystemLibrary) : CElementBuilder("Subsystem"), _pSubsystemLibrary(pSubsystemLibrary) +CSubsystemElementBuilder::CSubsystemElementBuilder(const CSubsystemLibrary* pSubsystemLibrary) : + CElementBuilder(), _pSubsystemLibrary(pSubsystemLibrary) { } diff --git a/parameter/SystemClass.cpp b/parameter/SystemClass.cpp index 98917d7..f3477c6 100644 --- a/parameter/SystemClass.cpp +++ b/parameter/SystemClass.cpp @@ -135,7 +135,8 @@ bool CSystemClass::loadSubsystems(string& strError, const CSubsystemPlugins* pSu log_info("All subsystem plugins successfully loaded"); // Add virtual subsystem builder - _pSubsystemLibrary->addElementBuilder(new TNamedElementBuilderTemplate<CVirtualSubsystem>("Virtual")); + _pSubsystemLibrary->addElementBuilder("Virtual", + new TNamedElementBuilderTemplate<CVirtualSubsystem>()); return true; } |