summaryrefslogtreecommitdiffstats
path: root/parameter/Parameter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'parameter/Parameter.cpp')
-rw-r--r--parameter/Parameter.cpp103
1 files changed, 5 insertions, 98 deletions
diff --git a/parameter/Parameter.cpp b/parameter/Parameter.cpp
index 57a78b1..70865ad 100644
--- a/parameter/Parameter.cpp
+++ b/parameter/Parameter.cpp
@@ -34,16 +34,12 @@
#include "ConfigurationAccessContext.h"
#include "ParameterBlackboard.h"
-#define base CInstanceConfigurableElement
+#define base CBaseParameter
CParameter::CParameter(const string& strName, const CTypeElement* pTypeElement) : base(strName, pTypeElement)
{
}
-CParameter::~CParameter()
-{
-}
-
CInstanceConfigurableElement::Type CParameter::getType() const
{
return EParameter;
@@ -55,32 +51,11 @@ bool CParameter::serializeXmlSettings(CXmlElement& xmlConfigurationSettingsEleme
// Check for value space
handleValueSpaceAttribute(xmlConfigurationSettingsElementContent, configurationAccessContext);
- // Handle access
- if (!configurationAccessContext.serializeOut()) {
-
- // Write to blackboard
- if (!doSetValue(xmlConfigurationSettingsElementContent.getTextContent(), getOffset() - configurationAccessContext.getBaseOffset(), configurationAccessContext)) {
-
- // Append parameter path to error
- configurationAccessContext.appendToError(" " + getPath());
-
- return false;
- }
- } else {
-
- // Get string value
- string strValue;
-
- doGetValue(strValue, getOffset() - configurationAccessContext.getBaseOffset(), configurationAccessContext);
-
- // Populate value into xml text node
- xmlConfigurationSettingsElementContent.setTextContent(strValue);
- }
-
- // Done
- return true;
+ // Base
+ return base::serializeXmlSettings(xmlConfigurationSettingsElementContent, configurationAccessContext);
}
+
// Value space handling for configuration import
void CParameter::handleValueSpaceAttribute(CXmlElement& xmlConfigurableElementSettingsElement, CConfigurationAccessContext& configurationAccessContext) const
{
@@ -98,18 +73,6 @@ uint32_t CParameter::getSize() const
return static_cast<const CParameterType*>(getTypeElement())->getSize();
}
-// Dump
-void CParameter::logValue(string& strValue, CErrorContext& errorContext) const
-{
- CParameterAccessContext& parameterContext = static_cast<CParameterAccessContext&>(errorContext);
-
- // Dump value
- doGetValue(strValue, getOffset(), parameterContext);
-
- // Prepend unit if any
- prependUnit(strValue);
-}
-
// Used for simulation only
void CParameter::setDefaultValues(CParameterAccessContext& parameterAccessContext) const
{
@@ -123,63 +86,7 @@ void CParameter::setDefaultValues(CParameterAccessContext& parameterAccessContex
pBlackboard->write(&uiDefaultValue, getSize(), getOffset(), parameterAccessContext.isBigEndianSubsystem());
}
-// Unit
-void CParameter::prependUnit(string& strValue) const
-{
- string strUnit = static_cast<const CParameterType*>(getTypeElement())->getUnit();
-
- if (!strUnit.empty()) {
-
- strValue = "(" + strUnit + ") " + strValue;
- }
-}
-
-// Parameter Access
-bool CParameter::setValue(CPathNavigator& pathNavigator, const string& strValue, CErrorContext& errorContext) const
-{
- // Check path validity
- if (!checkPathExhausted(pathNavigator, errorContext)) {
-
- return false;
- }
- // Parameter context
- CParameterAccessContext& parameterContext = static_cast<CParameterAccessContext&>(errorContext);
-
- // Set Value
- if (!doSetValue(strValue, getOffset(), parameterContext)) {
-
- // Append parameter path to error
- parameterContext.appendToError(" " + getPath());
-
- return false;
- }
- // Synchronize
- if (parameterContext.getAutoSync() && !sync(parameterContext)) {
-
- // Append parameter path to error
- parameterContext.appendToError(" " + getPath());
-
- return false;
- }
- return true;
-}
-
-bool CParameter::getValue(CPathNavigator& pathNavigator, string& strValue, CErrorContext& errorContext) const
-{
- // Check path validity
- if (!checkPathExhausted(pathNavigator, errorContext)) {
-
- return false;
- }
- // Parameter context
- CParameterAccessContext& parameterContext = static_cast<CParameterAccessContext&>(errorContext);
-
- // Get Value
- doGetValue(strValue, getOffset(), parameterContext);
-
- return true;
-}
-
+// Actual parameter access
bool CParameter::doSetValue(const string& strValue, uint32_t uiOffset, CParameterAccessContext& parameterAccessContext) const
{
uint32_t uiData;