Changeset 288 in pacpusframework for trunk/src/DBITEPlayerLib/DbtPlyEngine.cpp


Ignore:
Timestamp:
Mar 26, 2014, 9:27:30 PM (11 years ago)
Author:
Marek Kurdej
Message:

Using boost::shared_ptr for storing components.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/DBITEPlayerLib/DbtPlyEngine.cpp

    r277 r288  
    1010#include <Pacpus/kernel/Log.h>
    1111
    12 #include <cassert>
     12#include <boost/assert.hpp>
    1313#include <limits>
    1414#include <QDir>
     
    226226void DbtPlyEngine::playEvent()
    227227{
     228    using boost::dynamic_pointer_cast;
     229
    228230    LOG_DEBUG("Clicked: play");
    229231
    230232    // get user interface
    231233    ComponentManager * mgr = ComponentManager::getInstance();
    232     DbtPlyUserInterface * ui = dynamic_cast<DbtPlyUserInterface *>(mgr->getComponent("dbiteUserInterface"));
    233     assert(ui);
     234    boost::shared_ptr<DbtPlyUserInterface> ui = dynamic_pointer_cast<DbtPlyUserInterface>(mgr->getComponent("dbiteUserInterface"));
     235    BOOST_ASSERT(ui);
    234236    // get time value from slider
    235237    lastTDbt_ = ui->getTime() + tDbtMin_;
     
    268270void DbtPlyEngine::setState(DbtPlyEngineState * newState)
    269271{
    270     assert(newState);
     272    BOOST_ASSERT(newState);
    271273    LOG_DEBUG(mCurrentState->toString() << " => " << newState->toString());
    272274    mCurrentState = newState;
     
    284286        mSpeed = kMaxSpeed;
    285287    }
    286     assert(kMinSpeed <= mSpeed);
    287     assert(mSpeed <= kMaxSpeed);
     288    BOOST_ASSERT(kMinSpeed <= mSpeed);
     289    BOOST_ASSERT(mSpeed <= kMaxSpeed);
    288290    LOG_INFO("event: Speed Up, speed = " << mSpeed);
    289291    Q_EMIT displayStateSig(mCurrentState, mSpeed);
     
    296298        mSpeed = kMinSpeed;
    297299    }
    298     assert(kMinSpeed <= mSpeed);
    299     assert(mSpeed <= kMaxSpeed);
     300    BOOST_ASSERT(kMinSpeed <= mSpeed);
     301    BOOST_ASSERT(mSpeed <= kMaxSpeed);
    300302    LOG_INFO("event: Speed Up, speed = " << mSpeed);
    301303    Q_EMIT displayStateSig(mCurrentState, mSpeed);
     
    304306void DbtPlyEngine::reset()
    305307{
     308    using boost::dynamic_pointer_cast;
     309
    306310    lastTNow_ = road_time();
    307311    lastTDbt_ = tDbtMin_;
     
    311315    // get user interface
    312316    ComponentManager * mgr = ComponentManager::getInstance();
    313     DbtPlyUserInterface * ui = dynamic_cast<DbtPlyUserInterface *>(mgr->getComponent("dbiteUserInterface"));
    314     assert(ui);
     317    boost::shared_ptr<DbtPlyUserInterface> ui = dynamic_pointer_cast<DbtPlyUserInterface>(mgr->getComponent("dbiteUserInterface"));
     318    BOOST_ASSERT(ui);
    315319    // reset time value of the slider
    316320    ui->resetTime();
Note: See TracChangeset for help on using the changeset viewer.