Changeset 290 in pacpusframework
- Timestamp:
- Mar 27, 2014, 12:53:36 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/Pacpus/DbitePlayer/DbtPlyEngine.h
r179 r290 27 27 #include <string> 28 28 29 namespace pacpus { 29 namespace pacpus 30 { 30 31 31 32 class DbtPlyEngineStateChart; … … 45 46 /// e.g. replay_mode="2" 46 47 class DBITE_PLAYER_API DbtPlyEngine 47 : publicQThread48 48 : public QThread // FIXME: remove QThread 49 , public ComponentBase 49 50 { 50 51 Q_OBJECT -
trunk/include/Pacpus/DbitePlayer/DbtPlyFileManager.h
r288 r290 30 30 #include <Pacpus/kernel/DbiteFile.h> 31 31 32 #include <QString> 32 33 #include <QThread> 33 34 #include <string> … … 35 36 class QSemaphore; 36 37 37 namespace pacpus { 38 namespace pacpus 39 { 38 40 39 41 class DbtPlyEngine; … … 48 50 /// @see DbtPlyEngine 49 51 class DBITE_PLAYER_API DbtPlyFileManager 50 : publicQThread51 52 : public QThread // FIXME: remove QThread 53 , public ComponentBase 52 54 { 53 55 Q_OBJECT … … 61 63 /// the player replays only the last data that has not been yet replayed 62 64 /// @todo Rename 63 void playMode1 65 void playMode1(road_time_t tDbt, bool reverse); 64 66 /// the player replays all the data that have not been yet replayed 65 67 /// @todo Rename 66 void playMode2 68 void playMode2(road_time_t tDbt, bool reverse); 67 69 68 70 /// virtual method: call when new DBT data are replayed -
trunk/include/Pacpus/DbitePlayer/DbtPlyTrigger.h
r288 r290 16 16 #define DEF_PACPUS_DBTPLYTRIGGER_H 17 17 18 #include <QThread>19 20 18 #include <Pacpus/DbitePlayer/DbitePlayerConfig.h> 21 19 #include <Pacpus/DbitePlayer/DbtPlyEngine.h> 22 20 #include <Pacpus/kernel/ComponentBase.h> 23 21 #include <Pacpus/kernel/ComponentFactory.h> 22 23 #include <QString> 24 #include <QThread> 24 25 25 26 #ifdef WIN32 … … 28 29 #endif 29 30 30 namespace pacpus { 31 namespace pacpus 32 { 31 33 32 34 class DbtPlyEngine; 33 35 34 36 class DBITE_PLAYER_API DbtPlyTrigger 35 : publicQThread36 37 : public QThread // FIXME: remove QThread 38 , public ComponentBase 37 39 { 38 40 Q_OBJECT -
trunk/include/Pacpus/DbitePlayer/DbtPlyUserInterface.h
r288 r290 34 34 class QTableWidget; 35 35 36 namespace pacpus { 36 namespace pacpus 37 { 37 38 38 39 class DbtPlyEngine; … … 40 41 41 42 class DBITE_PLAYER_API DbtPlyUserInterface 42 43 43 : public QWidget 44 , public ComponentBase 44 45 { 45 46 Q_OBJECT -
trunk/include/Pacpus/kernel/ComponentBase.h
r288 r290 141 141 142 142 protected: 143 typedef QMap<QString, Input InterfaceBase *> InputsMap;144 typedef QMap<QString, Output InterfaceBase *> OutputsMap;143 typedef QMap<QString, InputSharedPointer> InputsMap; 144 typedef QMap<QString, OutputSharedPointer> OutputsMap; 145 145 146 146 template <typename DataType, class ComponentType, typename Function> … … 148 148 { 149 149 typedef InputInterface<DataType, ComponentType> InputType; 150 Input Type * connection = new InputType(name, dynamic_cast<ComponentType *>(this), function);150 InputSharedPointer connection(new InputType(name, dynamic_cast<ComponentType *>(this), function)); 151 151 inputs().insert(name, connection); 152 152 } … … 156 156 { 157 157 typedef OutputInterface<DataType, ComponentType> OutputType; 158 Output Type * connection = new OutputType(name, dynamic_cast<ComponentType *>(this));158 OutputSharedPointer connection(new OutputType(name, dynamic_cast<ComponentType *>(this))); 159 159 outputs().insert(name, connection); 160 160 } 161 161 162 162 /// @todo DOC 163 InputInterfaceBase 163 InputInterfaceBase* getInput(QString name) const; 164 164 165 165 /// @todo DOC 166 OutputInterfaceBase 166 OutputInterfaceBase* getOutput(QString name) const; 167 167 168 168 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)); 173 174 } 174 175 175 176 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)); 180 182 } 181 183 -
trunk/include/Pacpus/kernel/ComponentFactoryBase.h
r288 r290 18 18 #include <Pacpus/kernel/PacpusLibConfig.h> 19 19 20 #include <boost/s hared_ptr.hpp>21 //#include <boost/ weak_ptr.hpp>20 #include <boost/smart_ptr/shared_ptr.hpp> 21 //#include <boost/smart_ptr/weak_ptr.hpp> 22 22 23 23 class QString; -
trunk/include/Pacpus/kernel/InputOutputBase.h
r206 r290 7 7 #include <Pacpus/kernel/PacpusLibConfig.h> 8 8 9 #include <boost/smart_ptr/shared_ptr.hpp> 10 //#include <boost/smart_ptr/weak_ptr.hpp> 9 11 #include <QList> 10 12 #include <QString> … … 14 16 class QByteArray; 15 17 16 namespace pacpus { 18 namespace pacpus 19 { 17 20 18 21 class ComponentBase; … … 104 107 }; 105 108 109 typedef boost::shared_ptr<InputInterfaceBase> InputSharedPointer; 110 typedef boost::shared_ptr<OutputInterfaceBase> OutputSharedPointer; 111 106 112 } // namespace pacpus 107 113 -
trunk/include/Pacpus/kernel/InputOutputInterface.h
r287 r290 263 263 it->getPriority() 264 264 ); 265 LOG_TRACE("Send er: " <<getSignature());265 LOG_TRACE("Sending from " << getSignature() << " to " << it->getInterface()->getSignature()); 266 266 } 267 267 } … … 280 280 } 281 281 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 282 291 } // namespace pacpus 283 292 -
trunk/src/DBITEPlayerLib/DbtPlyTrigger.cpp
r288 r290 48 48 return CONFIGURED_FAILED; 49 49 } 50 connect(this, SIGNAL(triggerSig()),50 QObject::connect(this, SIGNAL(triggerSig()), 51 51 mEngine.get(), SLOT(engReceiver()), 52 52 Qt::DirectConnection); -
trunk/src/DBITEPlayerLib/DbtPlyUserInterface.cpp
r288 r290 167 167 QGridLayout * mainLayout = new QGridLayout(this); 168 168 169 butGroup = new QButtonGroup (this);169 butGroup = new QButtonGroup(this); 170 170 playBut = new QPushButton ("|>", this); 171 171 playBut->resize(kButtonWidthInPixels, kButtonHeightInPixels); … … 314 314 { 315 315 // FIXME: use Qt5 connect style 316 connect(playBut, SIGNAL(clicked()),316 QObject::connect(playBut, SIGNAL(clicked()), 317 317 mEngine.get(), SLOT(playEvent())); 318 connect(pauseBut, SIGNAL(clicked()),318 QObject::connect(pauseBut, SIGNAL(clicked()), 319 319 mEngine.get(), SLOT(pauseEvent())); 320 connect(stopBut, SIGNAL(clicked()),320 QObject::connect(stopBut, SIGNAL(clicked()), 321 321 mEngine.get(), SLOT(stopEvent())); 322 connect(speedUpBut, SIGNAL(clicked()),322 QObject::connect(speedUpBut, SIGNAL(clicked()), 323 323 mEngine.get(), SLOT(speedUpEvent())); 324 connect(speedDownBut, SIGNAL(clicked()),324 QObject::connect(speedDownBut, SIGNAL(clicked()), 325 325 mEngine.get(), SLOT(speedDownEvent())); 326 326 } … … 328 328 void DbtPlyUserInterface::connectDisplay() 329 329 { 330 connect(mEngine.get(), SIGNAL(displayStateSig(DbtPlyEngineState *, float)),330 QObject::connect(mEngine.get(), SIGNAL(displayStateSig(DbtPlyEngineState *, float)), 331 331 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)), 334 333 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)), 336 335 this, SLOT(displayTime(road_time_t))); 337 connect(rev, SIGNAL(toggled(bool)),336 QObject::connect(rev, SIGNAL(toggled(bool)), 338 337 mEngine.get(), SLOT(changeDirection(bool))); 339 338 } … … 341 340 void DbtPlyUserInterface::connectSlider() 342 341 { 343 connect(timeSlider, SIGNAL(sliderPressed()),342 QObject::connect(timeSlider, SIGNAL(sliderPressed()), 344 343 mEngine.get(), SLOT(pauseEvent())); 345 connect(timeSlider, SIGNAL(sliderReleased()),344 QObject::connect(timeSlider, SIGNAL(sliderReleased()), 346 345 mEngine.get(), SLOT(playEvent())); 347 346 } -
trunk/src/PacpusLib/ComponentBase.cpp
r288 r290 17 17 #include <boost/program_options/parsers.hpp> 18 18 #include <boost/program_options/variables_map.hpp> 19 //#include <boost/thread/thread.hpp>20 19 #include <ostream> 21 20 #include <string> … … 245 244 } 246 245 247 InputInterfaceBase 246 InputInterfaceBase* ComponentBase::getInput(QString inputName) const 248 247 { 249 248 if (inputs().contains(inputName)) { 250 return inputs()[inputName] ;249 return inputs()[inputName].get(); 251 250 } 252 251 LOG_WARN("Component " << getName() << " does not contain input " << inputName); … … 254 253 } 255 254 256 OutputInterfaceBase 255 OutputInterfaceBase* ComponentBase::getOutput(QString outputName) const 257 256 { 258 257 if (outputs().contains(outputName)) { 259 return outputs()[outputName] ;258 return outputs()[outputName].get(); 260 259 } 261 260 LOG_WARN("Component " << getName() << " does not contain output " << outputName); -
trunk/src/PacpusLib/ComponentManager.cpp
r288 r290 38 38 /// Connects OutputInterfaceBase @b out to InputInterfaceBase @b in using given priority and reading mode. 39 39 /// @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);40 bool connectInterface(OutputInterfaceBase* out, InputInterfaceBase* in, int priority, InputInterfaceBase::ReadingMode mode = InputInterfaceBase::GetLast); 41 41 42 42 //////////////////////////////////////////////////////////////////////////////// 43 43 44 bool connectInterface(OutputInterfaceBase * out, InputInterfaceBase* in, int priority, InputInterfaceBase::ReadingMode mode)44 bool connectInterface(OutputInterfaceBase* out, InputInterfaceBase* in, int priority, InputInterfaceBase::ReadingMode mode) 45 45 { 46 46 // check connections -
trunk/src/PacpusSensor/src/main.cpp
r289 r290 14 14 #include <boost/cstdlib.hpp> 15 15 #include <boost/exception/diagnostic_information.hpp> 16 #include <QApplication>17 #include <QThread>18 16 #ifdef WIN32 19 # 17 # define NOMINMAX 20 18 # include <windows.h> 21 19 #endif … … 64 62 PacpusMainWindow window; 65 63 window.show(); 66 LOG_INFO("Current Thread " << QThread::currentThread());67 64 68 65 int exitStatus = boost::exit_exception_failure;
Note:
See TracChangeset
for help on using the changeset viewer.