summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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;
}
}