コード例 #1
0
Bool DisplayControlArbitrator::arbitrate(UIntN policyIndex, UIntN displayControlIndex)
{
    Bool arbitratedValueChanged = false;
    UIntN maxRequestedDisplayControlIndex = Constants::Invalid;

    increaseVectorSizeIfNeeded(m_requestedDisplayControlIndex, policyIndex, Constants::Invalid);
    m_requestedDisplayControlIndex[policyIndex] = displayControlIndex;

    //
    // loop through the array and find the max requested display control index
    //
    for (UIntN i = 0; i < m_requestedDisplayControlIndex.size(); i++)
    {
        if ((m_requestedDisplayControlIndex[i] != Constants::Invalid) &&
            ((maxRequestedDisplayControlIndex == Constants::Invalid) ||
             (m_requestedDisplayControlIndex[i] > maxRequestedDisplayControlIndex)))
        {
            maxRequestedDisplayControlIndex = m_requestedDisplayControlIndex[i];
        }
    }

    //
    // check to see if the performance control index is changing.
    //
    if (maxRequestedDisplayControlIndex != m_arbitratedDisplayControlIndex)
    {
        arbitratedValueChanged = true;
        m_arbitratedDisplayControlIndex = maxRequestedDisplayControlIndex;
    }

    return arbitratedValueChanged;
}
コード例 #2
0
Bool PowerControlArbitrator::arbitrate(UIntN policyIndex, const PowerControlStatusSet& powerControlStatusSet)
{
    increaseVectorSizeIfNeeded(m_requestedPowerControlStatusSet, policyIndex);
    savePolicyRequest(policyIndex, powerControlStatusSet);
    std::vector<PowerControlStatus> arbitratedPowerControlStatusVector = createInitialArbitratedPowerControlStatusVector();
    arbitrate(arbitratedPowerControlStatusVector);
    PowerControlStatusSet arbitratedPowerControlStatusSet = getArbitratedPowerControlStatusSet(arbitratedPowerControlStatusVector);

    // see if the arbitrated PowerControlStatusSet is changing
    Bool arbitratedValueChanged = false;
    if (arbitratedPowerControlStatusSet != *m_arbitratedPowerControlStatusSet)
    {
        arbitratedValueChanged = true;
        delete m_arbitratedPowerControlStatusSet;
        m_arbitratedPowerControlStatusSet = new PowerControlStatusSet(arbitratedPowerControlStatusSet);
    }

    return arbitratedValueChanged;
}