Changeset 102 in pacpusframework for branches/2.0-beta1/include/Pacpus/kernel
- Timestamp:
- Jun 3, 2013, 6:13:21 PM (11 years ago)
- Location:
- branches/2.0-beta1/include/Pacpus/kernel
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.0-beta1/include/Pacpus/kernel/ConnectionBase.h
r96 r102 2 2 #define ConnectionBase_H 3 3 4 #include <Pacpus/kernel/pacpus.h> 4 5 5 6 namespace pacpus { … … 7 8 class AbstractInterface; 8 9 9 class ConnectionBase10 class PACPUSLIB_API ConnectionBase 10 11 { 11 12 public: -
branches/2.0-beta1/include/Pacpus/kernel/inputOutputBase.h
r100 r102 47 47 //InputInterfaceBase(QString name, ComponentBase * component,int a, QObject * parent = 0):AbstractInterface(name,component,parent) {} // TODO add ctor with function pointer 48 48 49 enum ReadingMode { 50 NeverSkip, 51 TimeBounded, 52 GetLast 53 }; 54 49 55 virtual ~InputInterfaceBase(){} 50 56 … … 60 66 } 61 67 68 void setReadingMode(ReadingMode mode) { readingMode_ = mode;} 62 69 virtual PacpusEvent getEventTemplate() {return PacpusEvent(GENERIC_EVENT);} // TODO check ?? 63 70 protected: 71 ReadingMode readingMode_; 64 72 }; 65 73 … … 103 111 in->addConnection(ConnectionBase(out,priority)); 104 112 //LOG_INFO("connection : Output " << out->getSignature() << " => Input " << in->getSignature()); 113 in->setReadingMode(InputInterfaceBase::NeverSkip); 105 114 return true; 106 115 } else { -
branches/2.0-beta1/include/Pacpus/kernel/inputOutputInterface.h
r96 r102 23 23 InputInterface(QString name, C * component, void (C::*m)(const T&)):InputInterfaceBase(name,component,component), method(m) {} 24 24 ~InputInterface() {} 25 26 enum ReadingMode {27 NeverSkip,28 TimeBounded,29 GetLast30 };31 32 void setReadingMode(ReadingMode mode) { readingMode_ = mode;}33 25 size_t getDataSize() {return sizeof(T);} 34 26 QString getDataType() {return QString(typeid(T).name());} 35 27 36 28 protected: 37 ReadingMode readingMode_;38 29 int boundingTime_; 39 30 … … 57 48 switch (readingMode_){ 58 49 case TimeBounded: 50 qDebug() << "Input " << this->getSignature() << " Time bournded "<< road_time()- typedEvent->t_ << " " << typedEvent->tr_; 59 51 if(road_time() - typedEvent->t_> typedEvent->tr_) 60 break; 52 { qDebug() << "Data skip " << this->getSignature(); 53 break;} 61 54 (dynamic_cast<C*>(_component)->*method)(typedEvent->_data); 62 55 break; 63 56 case GetLast: 57 qDebug() << "Input " << this->getSignature() << "GetLast "<< road_time() - typedEvent->t_ << " " << typedEvent->tr_; 64 58 (dynamic_cast<C*>(_component)->*method)(typedEvent->_data); 65 59 QCoreApplication::removePostedEvents(this,TYPED_EVENT); // delete all remining events 66 60 break; 67 61 case NeverSkip: 62 qDebug() << "Input " << this->getSignature() << "NeverSkip "<< road_time() - typedEvent->t_ << " " << typedEvent->tr_; 68 63 default: 69 64 (dynamic_cast<C*>(_component)->*method)(typedEvent->_data); … … 113 108 114 109 // Used by Components to send data througth typed output 115 void send(const T & data ) {110 void send(const T & data, road_time_t t = road_time(), road_timerange_t tr = 0) { 116 111 for(QList<ConnectionBase>::iterator it = _connection.begin(); it!=_connection.end(); ++it){ 117 112 118 113 //if(it->getInterface()->getDataType() != QString(typeid(QByteArray).name())) 119 QApplication::postEvent(it->getInterface(),new PacpusTypedEvent<T>(TYPED_EVENT,data ),it->getPriority());114 QApplication::postEvent(it->getInterface(),new PacpusTypedEvent<T>(TYPED_EVENT,data,t,tr),it->getPriority()); 120 115 /*else { 121 116 QByteArray buf;
Note:
See TracChangeset
for help on using the changeset viewer.