From 065264a93ce9c63b6a5c95e985188ee33ba587d3 Mon Sep 17 00:00:00 2001 From: Patrick Benavoli Date: Sun, 20 Nov 2011 15:46:41 +0100 Subject: PFW: Type safe dynamic parameter access BZ: 15065 Replaced high level string based parameter access interface with typed ones. Now hosting platforms that want to control parameters must instantiate a CParameterHandle object out of the desired parameter path. CParameterHandle object may be used to access any kind of parameters, whatever its internal type, whether it's an array or not. Note that non rogue parameters offer a read access only. Any attempt to write them will fail. CParameterHandle objects offer the following kind of parameter accessing interfaces: - Boolean - Integer (signed or unsigned) - Double - String Note that those interfaces are available for scalar as well as for array parameters. Not all parameter types support all access kinds. Naturally, array parameters are only accessed via array interfaces while scalar parameters are managed through scalar interfaces. Here's a list of parameter types that may be controlled through each kind of access interface: - Boolean access: boolean, bit (bit size must be one); - Integer access: integer (sign must match), boolean (unsigned access only, value <= 1), enumerations; - Double access: for now only fixed points (soon integers will support them also through platform adaptation objects) - String access: all parameter types In addition, cleaned up parameter access related code so as to make it more generic and reusable. Changed version to 2.0.0 Change-Id: Ib80868cdb773e90962e48f1f38d2ff0029189815 Signed-off-by: Patrick Benavoli Reviewed-on: http://android.intel.com:8080/25406 Reviewed-by: Barthes, FabienX Tested-by: Barthes, FabienX Reviewed-by: buildbot Tested-by: buildbot --- parameter/ConfigurableDomain.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'parameter/ConfigurableDomain.cpp') diff --git a/parameter/ConfigurableDomain.cpp b/parameter/ConfigurableDomain.cpp index c9e3266..696bbd0 100644 --- a/parameter/ConfigurableDomain.cpp +++ b/parameter/ConfigurableDomain.cpp @@ -32,7 +32,6 @@ #include "DomainConfiguration.h" #include "ConfigurableElement.h" #include "ConfigurationAccessContext.h" -#include "Subsystem.h" #include "XmlDomainSerializingContext.h" #include @@ -243,17 +242,15 @@ bool CConfigurableDomain::parseConfigurableElements(const CXmlElement& xmlElemen string strConfigurableElementPath = xmlConfigurableElementElement.getAttributeString("Path"); CPathNavigator pathNavigator(strConfigurableElementPath); - - string* pStrChildName = pathNavigator.next(); + string strError; // Is there an element and does it match system class name? - if (!pStrChildName || *pStrChildName != pSystemClassElement->getName()) { + if (!pathNavigator.navigateThrough(pSystemClassElement->getName(), strError)) { - serializingContext.setError("Could not find configurable element of path " + strConfigurableElementPath + " from ConfigurableDomain description " + getName()); + serializingContext.setError("Could not find configurable element of path " + strConfigurableElementPath + " from ConfigurableDomain description " + getName() + " (" + strError + ")"); return false; } - // Browse system class for configurable element CConfigurableElement* pConfigurableElement = static_cast(pSystemClassElement->findDescendant(pathNavigator)); @@ -264,7 +261,6 @@ bool CConfigurableDomain::parseConfigurableElements(const CXmlElement& xmlElemen return false; } // Add found element to domain - string strError; if (!addConfigurableElement(pConfigurableElement, NULL, strError)) { serializingContext.setError(strError); -- cgit v1.1