Changeset 290 in pacpusframework


Ignore:
Timestamp:
Mar 27, 2014, 12:53:36 PM (11 years ago)
Author:
Marek Kurdej
Message:

Some clean-up.

Location:
trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/Pacpus/DbitePlayer/DbtPlyEngine.h

    r179 r290  
    2727#include <string>
    2828
    29 namespace pacpus {
     29namespace pacpus
     30{
    3031
    3132class DbtPlyEngineStateChart;
     
    4546///         e.g. replay_mode="2"
    4647class DBITE_PLAYER_API DbtPlyEngine
    47         : public QThread
    48         , public ComponentBase
     48    : public QThread // FIXME: remove QThread
     49    , public ComponentBase
    4950{
    5051    Q_OBJECT
  • trunk/include/Pacpus/DbitePlayer/DbtPlyFileManager.h

    r288 r290  
    3030#include <Pacpus/kernel/DbiteFile.h>
    3131
     32#include <QString>
    3233#include <QThread>
    3334#include <string>
     
    3536class QSemaphore;
    3637
    37 namespace pacpus {
     38namespace pacpus
     39{
    3840
    3941class DbtPlyEngine;
     
    4850/// @see DbtPlyEngine
    4951class DBITE_PLAYER_API DbtPlyFileManager
    50         : public QThread
    51         , public ComponentBase
     52    : public QThread // FIXME: remove QThread
     53    , public ComponentBase
    5254{
    5355    Q_OBJECT
     
    6163    /// the player replays only the last data that has not been yet replayed
    6264    /// @todo Rename
    63     void playMode1 (road_time_t tDbt, bool reverse);
     65    void playMode1(road_time_t tDbt, bool reverse);
    6466    /// the player replays all the data that have not been yet replayed
    6567    /// @todo Rename
    66     void playMode2 (road_time_t tDbt, bool reverse);
     68    void playMode2(road_time_t tDbt, bool reverse);
    6769
    6870    /// virtual method: call when new DBT data are replayed
  • trunk/include/Pacpus/DbitePlayer/DbtPlyTrigger.h

    r288 r290  
    1616#define DEF_PACPUS_DBTPLYTRIGGER_H
    1717
    18 #include <QThread>
    19 
    2018#include <Pacpus/DbitePlayer/DbitePlayerConfig.h>
    2119#include <Pacpus/DbitePlayer/DbtPlyEngine.h>
    2220#include <Pacpus/kernel/ComponentBase.h>
    2321#include <Pacpus/kernel/ComponentFactory.h>
     22
     23#include <QString>
     24#include <QThread>
    2425
    2526#ifdef WIN32
     
    2829#endif
    2930
    30 namespace pacpus {
     31namespace pacpus
     32{
    3133
    3234class DbtPlyEngine;
    3335
    3436class DBITE_PLAYER_API DbtPlyTrigger
    35         : public QThread
    36         , public ComponentBase
     37    : public QThread // FIXME: remove QThread
     38    , public ComponentBase
    3739{   
    3840    Q_OBJECT
  • trunk/include/Pacpus/DbitePlayer/DbtPlyUserInterface.h

    r288 r290  
    3434class QTableWidget;
    3535
    36 namespace pacpus {
     36namespace pacpus
     37{
    3738   
    3839class DbtPlyEngine;
     
    4041
    4142class DBITE_PLAYER_API DbtPlyUserInterface
    42         : public QWidget
    43         , public ComponentBase
     43    : public QWidget
     44    , public ComponentBase
    4445{
    4546    Q_OBJECT
  • trunk/include/Pacpus/kernel/ComponentBase.h

    r288 r290  
    141141   
    142142protected:
    143     typedef QMap<QString, InputInterfaceBase *> InputsMap;
    144     typedef QMap<QString, OutputInterfaceBase *> OutputsMap;
     143    typedef QMap<QString, InputSharedPointer> InputsMap;
     144    typedef QMap<QString, OutputSharedPointer> OutputsMap;
    145145
    146146    template <typename DataType, class ComponentType, typename Function>
     
    148148    {
    149149        typedef InputInterface<DataType, ComponentType> InputType;
    150         InputType * connection = new InputType(name, dynamic_cast<ComponentType *>(this), function);
     150        InputSharedPointer connection(new InputType(name, dynamic_cast<ComponentType *>(this), function));
    151151        inputs().insert(name, connection);
    152152    }
     
    156156    {
    157157        typedef OutputInterface<DataType, ComponentType> OutputType;
    158         OutputType * connection = new OutputType(name, dynamic_cast<ComponentType *>(this));
     158        OutputSharedPointer connection(new OutputType(name, dynamic_cast<ComponentType *>(this)));
    159159        outputs().insert(name, connection);
    160160    }
    161161   
    162162    /// @todo DOC
    163     InputInterfaceBase * getInput(QString name) const;
     163    InputInterfaceBase* getInput(QString name) const;
    164164
    165165    /// @todo DOC
    166     OutputInterfaceBase * getOutput(QString name) const;
     166    OutputInterfaceBase* getOutput(QString name) const;
    167167
    168168    template <typename DataType, class ComponentType>
    169     InputInterface<DataType, ComponentType> *
    170         getTypedInput(const char * name) const
    171     {
    172         return dynamic_cast<InputInterface<DataType, ComponentType> *>(getInput(name));
     169    InputInterface<DataType, ComponentType>* getTypedInput(const char * name) const
     170    {
     171        //using boost::dynamic_pointer_cast;
     172        //return dynamic_pointer_cast<InputInterface<DataType, ComponentType> >(getInput(name));
     173        return dynamic_cast<InputInterface<DataType, ComponentType>*>(getInput(name));
    173174    }
    174175
    175176    template <typename DataType, class ComponentType>
    176     OutputInterface<DataType, ComponentType> *
    177         getTypedOutput(const char * name) const
    178     {
    179         return dynamic_cast<OutputInterface<DataType, ComponentType> *>(getOutput(name));
     177    OutputInterface<DataType, ComponentType>* getTypedOutput(const char * name) const
     178    {
     179        //using boost::dynamic_pointer_cast;
     180        //return dynamic_pointer_cast<OutputInterface<DataType, ComponentType> >(getOutput(name));
     181        return dynamic_cast<OutputInterface<DataType, ComponentType>*>(getOutput(name));
    180182    }
    181183
  • trunk/include/Pacpus/kernel/ComponentFactoryBase.h

    r288 r290  
    1818#include <Pacpus/kernel/PacpusLibConfig.h>
    1919
    20 #include <boost/shared_ptr.hpp>
    21 //#include <boost/weak_ptr.hpp>
     20#include <boost/smart_ptr/shared_ptr.hpp>
     21//#include <boost/smart_ptr/weak_ptr.hpp>
    2222
    2323class QString;
  • trunk/include/Pacpus/kernel/InputOutputBase.h

    r206 r290  
    77#include <Pacpus/kernel/PacpusLibConfig.h>
    88
     9#include <boost/smart_ptr/shared_ptr.hpp>
     10//#include <boost/smart_ptr/weak_ptr.hpp>
    911#include <QList>
    1012#include <QString>
     
    1416class QByteArray;
    1517
    16 namespace pacpus {
     18namespace pacpus
     19{
    1720
    1821class ComponentBase;
     
    104107};
    105108
     109typedef boost::shared_ptr<InputInterfaceBase> InputSharedPointer;
     110typedef boost::shared_ptr<OutputInterfaceBase> OutputSharedPointer;
     111
    106112} // namespace pacpus
    107113
  • trunk/include/Pacpus/kernel/InputOutputInterface.h

    r287 r290  
    263263            it->getPriority()
    264264        );
    265         LOG_TRACE("Sender: " << getSignature());
     265        LOG_TRACE("Sending from " << getSignature() << " to " << it->getInterface()->getSignature());
    266266    }
    267267}
     
    280280}
    281281
     282//template <typename T1, typename T2, class C>
     283//bool checkedSend(boost::shared_ptr< OutputInterface<T1, C> > sender, T2 const& data, road_time_t t = road_time(), road_timerange_t tr = 0);
     284//
     285//template <typename T1, typename T2, class C>
     286//bool checkedSend(boost::shared_ptr< OutputInterface<T1, C> > sender, T2 const& data, road_time_t t, road_timerange_t tr)
     287//{
     288//    return checkedSend(sender.get(), data, t, tr);
     289//}
     290
    282291} // namespace pacpus
    283292
  • trunk/src/DBITEPlayerLib/DbtPlyTrigger.cpp

    r288 r290  
    4848        return CONFIGURED_FAILED;
    4949    }
    50     connect(this, SIGNAL(triggerSig()),
     50    QObject::connect(this, SIGNAL(triggerSig()),
    5151            mEngine.get(), SLOT(engReceiver()),
    5252            Qt::DirectConnection);
  • trunk/src/DBITEPlayerLib/DbtPlyUserInterface.cpp

    r288 r290  
    167167    QGridLayout * mainLayout = new QGridLayout(this);
    168168
    169     butGroup = new QButtonGroup (this );
     169    butGroup = new QButtonGroup(this);
    170170    playBut = new QPushButton ("|>", this);
    171171    playBut->resize(kButtonWidthInPixels, kButtonHeightInPixels);
     
    314314{
    315315    // FIXME: use Qt5 connect style
    316     connect(playBut, SIGNAL(clicked()),
     316    QObject::connect(playBut, SIGNAL(clicked()),
    317317        mEngine.get(), SLOT(playEvent()));
    318     connect(pauseBut, SIGNAL(clicked()),
     318    QObject::connect(pauseBut, SIGNAL(clicked()),
    319319        mEngine.get(), SLOT(pauseEvent()));
    320     connect(stopBut, SIGNAL(clicked()),
     320    QObject::connect(stopBut, SIGNAL(clicked()),
    321321        mEngine.get(), SLOT(stopEvent()));
    322     connect(speedUpBut, SIGNAL(clicked()),
     322    QObject::connect(speedUpBut, SIGNAL(clicked()),
    323323        mEngine.get(), SLOT(speedUpEvent()));
    324     connect(speedDownBut, SIGNAL(clicked()),
     324    QObject::connect(speedDownBut, SIGNAL(clicked()),
    325325        mEngine.get(), SLOT(speedDownEvent()));
    326326}
     
    328328void DbtPlyUserInterface::connectDisplay()
    329329{
    330     connect(mEngine.get(), SIGNAL(displayStateSig(DbtPlyEngineState *, float)),
     330    QObject::connect(mEngine.get(), SIGNAL(displayStateSig(DbtPlyEngineState *, float)),
    331331        this, SLOT(displayStateSlot(DbtPlyEngineState *, float)));
    332 
    333     connect (mEngine.get(), SIGNAL(timeMinMax(road_time_t, road_time_t)),
     332    QObject::connect(mEngine.get(), SIGNAL(timeMinMax(road_time_t, road_time_t)),
    334333        this, SLOT(displayMinMaxTime(road_time_t , road_time_t)));
    335     connect (mEngine.get(), SIGNAL(curReplayTime(road_time_t)),
     334    QObject::connect(mEngine.get(), SIGNAL(curReplayTime(road_time_t)),
    336335        this, SLOT(displayTime(road_time_t)));
    337     connect (rev, SIGNAL(toggled(bool)),
     336    QObject::connect(rev, SIGNAL(toggled(bool)),
    338337        mEngine.get(), SLOT(changeDirection(bool)));
    339338}
     
    341340void DbtPlyUserInterface::connectSlider()
    342341{
    343     connect (timeSlider, SIGNAL(sliderPressed()),
     342    QObject::connect(timeSlider, SIGNAL(sliderPressed()),
    344343        mEngine.get(), SLOT(pauseEvent()));
    345     connect (timeSlider, SIGNAL(sliderReleased()),
     344    QObject::connect(timeSlider, SIGNAL(sliderReleased()),
    346345        mEngine.get(), SLOT(playEvent()));
    347346}
  • trunk/src/PacpusLib/ComponentBase.cpp

    r288 r290  
    1717#include <boost/program_options/parsers.hpp>
    1818#include <boost/program_options/variables_map.hpp>
    19 //#include <boost/thread/thread.hpp>
    2019#include <ostream>
    2120#include <string>
     
    245244}
    246245
    247 InputInterfaceBase * ComponentBase::getInput(QString inputName) const
     246InputInterfaceBase* ComponentBase::getInput(QString inputName) const
    248247{
    249248    if (inputs().contains(inputName)) {
    250         return inputs()[inputName];
     249        return inputs()[inputName].get();
    251250    }
    252251    LOG_WARN("Component " << getName() << " does not contain input " << inputName);
     
    254253}
    255254
    256 OutputInterfaceBase * ComponentBase::getOutput(QString outputName) const
     255OutputInterfaceBase* ComponentBase::getOutput(QString outputName) const
    257256{
    258257    if (outputs().contains(outputName)) {
    259         return outputs()[outputName];
     258        return outputs()[outputName].get();
    260259    }
    261260    LOG_WARN("Component " << getName() << " does not contain output " << outputName);
  • trunk/src/PacpusLib/ComponentManager.cpp

    r288 r290  
    3838/// Connects OutputInterfaceBase @b out to InputInterfaceBase @b in using given priority and reading mode.
    3939/// @returns @b true if connection has been added successfully, @b false otherwise.
    40 bool connectInterface(OutputInterfaceBase * out, InputInterfaceBase * in, int priority, InputInterfaceBase::ReadingMode mode = InputInterfaceBase::GetLast);
     40bool connectInterface(OutputInterfaceBase* out, InputInterfaceBase* in, int priority, InputInterfaceBase::ReadingMode mode = InputInterfaceBase::GetLast);
    4141
    4242////////////////////////////////////////////////////////////////////////////////
    4343
    44 bool connectInterface(OutputInterfaceBase * out, InputInterfaceBase * in, int priority, InputInterfaceBase::ReadingMode mode)
     44bool connectInterface(OutputInterfaceBase* out, InputInterfaceBase* in, int priority, InputInterfaceBase::ReadingMode mode)
    4545{
    4646    // check connections
  • trunk/src/PacpusSensor/src/main.cpp

    r289 r290  
    1414#include <boost/cstdlib.hpp>
    1515#include <boost/exception/diagnostic_information.hpp>
    16 #include <QApplication>
    17 #include <QThread>
    1816#ifdef WIN32
    19 #       define NOMINMAX
     17#   define NOMINMAX
    2018#   include <windows.h>
    2119#endif
     
    6462    PacpusMainWindow window;
    6563    window.show();
    66     LOG_INFO("Current Thread " << QThread::currentThread());
    6764   
    6865    int exitStatus = boost::exit_exception_failure;
Note: See TracChangeset for help on using the changeset viewer.