コード例 #1
0
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;
}
コード例 #2
0
// 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());
}
コード例 #3
0
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);
}
コード例 #4
0
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;
}
コード例 #5
0
// 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;
}