bool CInstanceConfigurableElement::sync(CParameterAccessContext& parameterAccessContext) const { if (!parameterAccessContext.getAutoSync()) { // AutoSync is disabled, do not perform the sync. // This is not an error, but the expected behavior so return true anyway. return true; } ISyncer* pSyncer = getSyncer(); if (!pSyncer) { parameterAccessContext.setError("Unable to synchronize modification. No Syncer object associated to configurable element:"); return false; } std::string strError; if (!pSyncer->sync(*parameterAccessContext.getParameterBlackboard(), false, strError)) { parameterAccessContext.setError(strError); return false; } return true; }
// Used for simulation and virtual subsystems void CParameter::setDefaultValues(CParameterAccessContext& parameterAccessContext) const { // Get default value from type uint32_t uiDefaultValue = static_cast<const CParameterType*>(getTypeElement())->getDefaultValue(); // Write blackboard CParameterBlackboard* pBlackboard = parameterAccessContext.getParameterBlackboard(); // Beware this code works on little endian architectures only! pBlackboard->writeInteger(&uiDefaultValue, getSize(), getOffset() - parameterAccessContext.getBaseOffset(), parameterAccessContext.isBigEndianSubsystem()); }
bool CParameter::doGet(type& value, uint32_t uiOffset, CParameterAccessContext& parameterAccessContext) const { uint32_t uiData = 0; // Read blackboard const CParameterBlackboard* pBlackboard = parameterAccessContext.getParameterBlackboard(); // Beware this code works on little endian architectures only! pBlackboard->readInteger(&uiData, getSize(), uiOffset, parameterAccessContext.isBigEndianSubsystem()); return static_cast<const CParameterType*>(getTypeElement())->fromBlackboard(value, uiData, parameterAccessContext); }
bool CParameter::doSet(type value, uint32_t uiOffset, CParameterAccessContext& parameterAccessContext) const { uint32_t uiData; if (!static_cast<const CParameterType*>(getTypeElement())->toBlackboard(value, uiData, parameterAccessContext)) { return false; } // Write blackboard CParameterBlackboard* pBlackboard = parameterAccessContext.getParameterBlackboard(); // Beware this code works on little endian architectures only! pBlackboard->writeInteger(&uiData, getSize(), uiOffset, parameterAccessContext.isBigEndianSubsystem()); return true; }
// Sync bool CInstanceConfigurableElement::sync(CParameterAccessContext& parameterAccessContext) const { ISyncer* pSyncer = getSyncer(); if (!pSyncer) { parameterAccessContext.setError("Unable to synchronize modification. No Syncer object associated to configurable element:"); return false; } string strError; if (!pSyncer->sync(*parameterAccessContext.getParameterBlackboard(), false, strError)) { parameterAccessContext.setError(strError); return false; } return true; }