Changeset 96 in pacpusframework for branches/2.0-beta1/include/Pacpus/kernel/inputOutputInterface.h
- Timestamp:
- 05/23/13 12:16:31 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.0-beta1/include/Pacpus/kernel/inputOutputInterface.h
r95 r96 4 4 #include <Pacpus/kernel/Log.h> 5 5 #include <Pacpus/kernel/inputOutputBase.h> 6 #include <Pacpus/kernel/PacpusEvent.h>7 6 8 7 #include <typeinfo> … … 41 40 public: 42 41 42 PacpusEvent getEventTemplate() {return PacpusTypedEvent<T>(TYPED_EVENT); } 43 43 44 void customEvent(QEvent* event) { 44 45 … … 72 73 73 74 // from Connection interface to Component (G->T) 74 case GENERIC_EVENT2: {75 /* case GENERIC_EVENT2: { 75 76 PacpusTypedEvent<QByteArray> * genericEvent = dynamic_cast<PacpusTypedEvent<QByteArray> *> (event); 76 qDebug() << "E2 ";77 //if(sizeof(T) != genericEvent->_data.size())78 // qDebug() << "Incorrecte size " << sizeof(T) << " " << genericEvent->_data.size();79 qDebug() << "t[18]= " << road_time();80 77 T data; 81 78 QByteArray& buf = (QByteArray&) genericEvent->_data; 82 //qDebug() << "DataSize " <<buf.size();83 79 QDataStream in(&buf,QIODevice::ReadOnly); 84 80 85 qDebug() << "t[19]= " << road_time();86 //in >> data; // copy 787 qDebug() << "t[20]= " << road_time();88 89 81 (dynamic_cast<C*>(_component)->*method)(data); // copy 8 X 90 91 qDebug() << "t[21]= " << road_time();92 82 break; 93 83 } … … 96 86 case GENERIC_EVENT3: { 97 87 PacpusTypedEvent<T> * typedEvent = dynamic_cast<PacpusTypedEvent<T> *> (event); 98 qDebug() << "E3 ";99 qDebug() << "t[6]= " << road_time();100 88 (dynamic_cast<C*>(_component)->*method)(typedEvent->_data); // copy 3 X 101 qDebug() << "t[7]= " << road_time(); 89 102 90 break; 103 } 91 }*/ 104 92 105 93 default: 106 94 107 qDebug() << " Badevent ID " << event->type();95 qDebug() << "Unknown event ID " << event->type(); 108 96 break; 109 97 } … … 128 116 for(QList<ConnectionBase>::iterator it = _connection.begin(); it!=_connection.end(); ++it){ 129 117 130 if(it->getInputInterface()->getDataType() != QString(typeid(QByteArray).name())) 131 QApplication::postEvent(it->getInputInterface(),new PacpusTypedEvent<T>(QEvent::Type(TYPED_EVENT),data),it->getPriority()); 132 else { 133 qDebug() << "t[1]= " << road_time(); 134 //QByteArray buf((char*)(&data),sizeof(T)); 118 //if(it->getInterface()->getDataType() != QString(typeid(QByteArray).name())) 119 QApplication::postEvent(it->getInterface(),new PacpusTypedEvent<T>(TYPED_EVENT,data),it->getPriority()); 120 /*else { 135 121 QByteArray buf; 136 122 QDataStream out(&buf,QIODevice::ReadWrite); 137 qDebug() << "t[2]= " << road_time(); 138 // out << data; // Copy 1 139 qDebug() << "t[3]= " << road_time(); 140 141 PacpusTypedEvent<QByteArray> * ev =new PacpusTypedEvent<QByteArray>(QEvent::Type(GENERIC_EVENT3),buf); 142 qDebug() << "t[4]= " << road_time(); 143 QApplication::postEvent(it->getInputInterface(),ev,it->getPriority()); // Copy 2 (ctor) 144 qDebug() << "t[5]= " << road_time(); 145 //QApplication::postEvent(it->getInputInterface(),new PacpusTypedEvent<QByteArray>(QEvent::Type(GENERIC_EVENT3),buf),it->getPriority()); // Copy 2 (ctor) 146 } 147 148 //qDebug() << "send thread " << QThread::currentThread(); 123 PacpusTypedEvent<QByteArray> * ev =new PacpusTypedEvent<QByteArray>(GENERIC_EVENT3,buf); 124 QApplication::postEvent(it->getInterface(),ev,it->getPriority()); // Copy 2 (ctor) 125 }*/ 149 126 } 150 127 } 151 128 152 129 // Used by Connection Interfaces only to pose generic event 153 void sendGenericData(char * data, size_t size) { 154 qDebug() << "t[15]= " << road_time(); 130 /* void sendGenericData(char * data, size_t size) { 155 131 QByteArray buf(data,size); // copy 5 156 qDebug() << "t[16]= " << road_time();157 132 for(QList<ConnectionBase>::iterator it = _connection.begin(); it!=_connection.end(); ++it) 158 QApplication::postEvent(it->getIn putInterface(),new PacpusTypedEvent<QByteArray>(QEvent::Type(GENERIC_EVENT2),buf),it->getPriority()); // Copy 6(ctor)159 qDebug() << "t[17]= " << road_time(); 160 //qDebug() << "send thread " << QThread::currentThread(); 133 QApplication::postEvent(it->getInterface(),new PacpusTypedEvent<QByteArray>(GENERIC_EVENT2,buf),it->getPriority()); // Copy 6(ctor) 134 135 161 136 } 162 137 */ 163 138 size_t getDataSize() {return sizeof(T);} 164 139 QString getDataType() {return QString(typeid(T).name());}
Note:
See TracChangeset
for help on using the changeset viewer.