aboutsummaryrefslogtreecommitdiffstats
path: root/parameter/ConfigurableElement.cpp
diff options
context:
space:
mode:
authorPatrick Benavoli <patrickx.benavoli@intel.com>2011-11-20 15:46:41 +0100
committerDavid Wagner <david.wagner@intel.com>2014-02-10 17:15:00 +0100
commit065264a93ce9c63b6a5c95e985188ee33ba587d3 (patch)
tree01897cd4ed658e6a41f21061146098d0385734fd /parameter/ConfigurableElement.cpp
parent6ccab9d382c08323fb1f000d859a696f05719c92 (diff)
downloadexternal_parameter-framework-065264a93ce9c63b6a5c95e985188ee33ba587d3.zip
external_parameter-framework-065264a93ce9c63b6a5c95e985188ee33ba587d3.tar.gz
external_parameter-framework-065264a93ce9c63b6a5c95e985188ee33ba587d3.tar.bz2
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 <patrickx.benavoli@intel.com> Reviewed-on: http://android.intel.com:8080/25406 Reviewed-by: Barthes, FabienX <fabienx.barthes@intel.com> Tested-by: Barthes, FabienX <fabienx.barthes@intel.com> Reviewed-by: buildbot <buildbot@intel.com> Tested-by: buildbot <buildbot@intel.com>
Diffstat (limited to 'parameter/ConfigurableElement.cpp')
-rw-r--r--parameter/ConfigurableElement.cpp38
1 files changed, 11 insertions, 27 deletions
diff --git a/parameter/ConfigurableElement.cpp b/parameter/ConfigurableElement.cpp
index c5d97f8..93acf3f 100644
--- a/parameter/ConfigurableElement.cpp
+++ b/parameter/ConfigurableElement.cpp
@@ -127,13 +127,13 @@ bool CConfigurableElement::serializeXmlSettings(CXmlElement& xmlConfigurationSet
}
// Parameter access
-bool CConfigurableElement::setValue(CPathNavigator& pathNavigator, const string& strValue, CParameterAccessContext& parameterContext) const
+bool CConfigurableElement::accessValue(CPathNavigator& pathNavigator, string& strValue, bool bSet, CParameterAccessContext& parameterAccessContext) const
{
string* pStrChildName = pathNavigator.next();
if (!pStrChildName) {
- parameterContext.setError("Non settable element");
+ parameterAccessContext.setError("Non accessible element");
return false;
}
@@ -142,35 +142,12 @@ bool CConfigurableElement::setValue(CPathNavigator& pathNavigator, const string&
if (!pChild) {
- parameterContext.setError("Path not found: " + pathNavigator.getCurrentPath());
+ parameterAccessContext.setError("Path not found: " + pathNavigator.getCurrentPath());
return false;
}
- return pChild->setValue(pathNavigator, strValue, parameterContext);
-}
-
-bool CConfigurableElement::getValue(CPathNavigator& pathNavigator, string& strValue, CParameterAccessContext& parameterContext) const
-{
- string* pStrChildName = pathNavigator.next();
-
- if (!pStrChildName) {
-
- parameterContext.setError("Non gettable element");
-
- return false;
- }
-
- const CConfigurableElement* pChild = static_cast<const CConfigurableElement*>(findChild(*pStrChildName));
-
- if (!pChild) {
-
- parameterContext.setError("Path not found: " + pathNavigator.getCurrentPath());
-
- return false;
- }
-
- return pChild->getValue(pathNavigator, strValue, parameterContext);
+ return pChild->accessValue(pathNavigator, strValue, bSet, parameterAccessContext);
}
// Used for simulation and virtual subsystems
@@ -489,6 +466,13 @@ const CSubsystem* CConfigurableElement::getBelongingSubsystem() const
return static_cast<const CConfigurableElement*>(pParent)->getBelongingSubsystem();
}
+// Check element is a parameter
+bool CConfigurableElement::isParameter() const
+{
+ return false;
+}
+
+
// Check parent is still of current type (by structure knowledge)
bool CConfigurableElement::isOfConfigurableElementType(const CElement* pParent) const
{