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; }
// 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()); }