summaryrefslogtreecommitdiffstats
path: root/parameter
diff options
context:
space:
mode:
authorFrancois Gaffie <francois.gaffie@intel.com>2014-04-07 13:47:48 +0200
committerMattijs Korpershoek <mattijsx.korpershoek@intel.com>2014-06-24 11:51:36 +0200
commita1258f4f8121fbda5223e3875ac7ef6d53195e4c (patch)
treeeb94f0cb98256c1a5b0d17726798f1ad5daf52e1 /parameter
parent8ab7293fc32d078f558985b938fa5c71c2b0404b (diff)
downloadexternal_parameter-framework-a1258f4f8121fbda5223e3875ac7ef6d53195e4c.zip
external_parameter-framework-a1258f4f8121fbda5223e3875ac7ef6d53195e4c.tar.gz
external_parameter-framework-a1258f4f8121fbda5223e3875ac7ef6d53195e4c.tar.bz2
Add explicit API to append parameter path to error log
BZ: 183857 Explicit API names makes the code easier to read, allowing even to remove some comments. This patch adds an API to append the parameter path to the error log. Change-Id: Id136497072e53c8dd0ea3d95354e1dfe6193f771 Signed-off-by: Francois Gaffie <francois.gaffie@intel.com> Signed-off-by: Mattijs Korpershoek <mattijsx.korpershoek@intel.com>
Diffstat (limited to 'parameter')
-rw-r--r--parameter/ArrayParameter.cpp12
-rw-r--r--parameter/BaseParameter.cpp16
-rw-r--r--parameter/BaseParameter.h7
-rw-r--r--parameter/BitParameter.cpp8
-rw-r--r--parameter/Parameter.cpp8
5 files changed, 27 insertions, 24 deletions
diff --git a/parameter/ArrayParameter.cpp b/parameter/ArrayParameter.cpp
index 47000a7..a1184cd 100644
--- a/parameter/ArrayParameter.cpp
+++ b/parameter/ArrayParameter.cpp
@@ -121,8 +121,7 @@ bool CArrayParameter::accessValue(CPathNavigator& pathNavigator, string& strValu
// Synchronize
if (!sync(parameterAccessContext)) {
- // Append parameter path to error
- parameterAccessContext.appendToError(" " + getPath());
+ appendParameterPathToError(parameterAccessContext);
return false;
}
} else {
@@ -330,22 +329,19 @@ bool CArrayParameter::accessValues(vector<type>& values, bool bSet, CParameterAc
// Set Value
if (!setValues(values, parameterAccessContext)) {
- // Append parameter path to error
- parameterAccessContext.appendToError(" " + getPath());
+ appendParameterPathToError(parameterAccessContext);
return false;
}
if (!sync(parameterAccessContext)) {
- // Append parameter path to error
- parameterAccessContext.appendToError(" " + getPath());
+ appendParameterPathToError(parameterAccessContext);
return false;
}
} else {
// Get Value
if (!getValues(values, parameterAccessContext)) {
- // Append parameter path to error
- parameterAccessContext.appendToError(" " + getPath());
+ appendParameterPathToError(parameterAccessContext);
return false;
}
}
diff --git a/parameter/BaseParameter.cpp b/parameter/BaseParameter.cpp
index 3c49471..078c9b2 100644
--- a/parameter/BaseParameter.cpp
+++ b/parameter/BaseParameter.cpp
@@ -49,8 +49,7 @@ bool CBaseParameter::serializeXmlSettings(CXmlElement& xmlConfigurationSettingsE
// Write to blackboard
if (!doSetValue(xmlConfigurationSettingsElementContent.getTextContent(), getOffset() - configurationAccessContext.getBaseOffset(), configurationAccessContext)) {
- // Append parameter path to error
- configurationAccessContext.appendToError(" " + getPath());
+ appendParameterPathToError(configurationAccessContext);
return false;
}
} else {
@@ -177,15 +176,13 @@ bool CBaseParameter::accessAsString(string& strValue, bool bSet, CParameterAcces
// Set Value
if (!doSetValue(strValue, getOffset() - parameterAccessContext.getBaseOffset(), parameterAccessContext)) {
- // Append parameter path to error
- parameterAccessContext.appendToError(" " + getPath());
+ appendParameterPathToError(parameterAccessContext);
return false;
}
// Synchronize
if (!sync(parameterAccessContext)) {
- // Append parameter path to error
- parameterAccessContext.appendToError(" " + getPath());
+ appendParameterPathToError(parameterAccessContext);
return false;
}
@@ -227,3 +224,10 @@ void CBaseParameter::toXml(CXmlElement& xmlElement, CXmlSerializingContext& seri
// Delegate to type element
getTypeElement()->toXml(xmlElement, serializingContext);
}
+
+
+void CBaseParameter::appendParameterPathToError(CParameterAccessContext& parameterAccessContext)
+const
+{
+ parameterAccessContext.appendToError(" " + getPath());
+}
diff --git a/parameter/BaseParameter.h b/parameter/BaseParameter.h
index 7221fbc..3b1296e 100644
--- a/parameter/BaseParameter.h
+++ b/parameter/BaseParameter.h
@@ -80,4 +80,11 @@ protected:
// Actual value access (to be implemented by derived)
virtual bool doSetValue(const string& strValue, uint32_t uiOffset, CParameterAccessContext& parameterAccessContext) const = 0;
virtual void doGetValue(string& strValue, uint32_t uiOffset, CParameterAccessContext& parameterAccessContext) const = 0;
+
+ /**
+ * Append the parameter path to the error.
+ *
+ * @param[in:out] parameterAccessContext Parameter Access Context object.
+ */
+ void appendParameterPathToError(CParameterAccessContext& parameterAccessContext) const;
};
diff --git a/parameter/BitParameter.cpp b/parameter/BitParameter.cpp
index 2077cde..d239ed8 100644
--- a/parameter/BitParameter.cpp
+++ b/parameter/BitParameter.cpp
@@ -79,8 +79,7 @@ bool CBitParameter::accessAsBoolean(bool& bValue, bool bSet, CParameterAccessCon
if (static_cast<const CBitParameterType*>(getTypeElement())->getBitSize() != 1) {
parameterAccessContext.setError("Type mismatch");
- // Append parameter path to error
- parameterAccessContext.appendToError(" " + getPath());
+ appendParameterPathToError(parameterAccessContext);
return false;
}
@@ -116,14 +115,13 @@ bool CBitParameter::accessAsInteger(uint64_t& uiValue, bool bSet, CParameterAcce
// Set Value
if (!doSet(uiValue, uiOffset, parameterAccessContext)) {
- // Append parameter path to error
- parameterAccessContext.appendToError(" " + getPath());
+ appendParameterPathToError(parameterAccessContext);
return false;
}
// Synchronize
if (!sync(parameterAccessContext)) {
- parameterAccessContext.appendToError(" " + getPath());
+ appendParameterPathToError(parameterAccessContext);
return false;
}
} else {
diff --git a/parameter/Parameter.cpp b/parameter/Parameter.cpp
index 75433dd..36903f6 100644
--- a/parameter/Parameter.cpp
+++ b/parameter/Parameter.cpp
@@ -130,15 +130,14 @@ bool CParameter::doAccess(type& value, bool bSet,
if (!doSet(value, getOffset() - parameterAccessContext.getBaseOffset(),
parameterAccessContext)) {
- // Append parameter path to error
- parameterAccessContext.appendToError(" " + getPath());
+ appendParameterPathToError(parameterAccessContext);
return false;
}
// Synchronize
if (!sync(parameterAccessContext)){
- parameterAccessContext.appendToError(" " + getPath());
+ appendParameterPathToError(parameterAccessContext);
return false;
}
} else {
@@ -146,8 +145,7 @@ bool CParameter::doAccess(type& value, bool bSet,
if (!doGet(value, getOffset() - parameterAccessContext.getBaseOffset(),
parameterAccessContext)) {
- // Append parameter path to error
- parameterAccessContext.appendToError(" " + getPath());
+ appendParameterPathToError(parameterAccessContext);
return false;
}
}