Changeset 110 in pacpusframework for branches/2.0-beta1/include/Pacpus/kernel/inputOutputBase.h
- Timestamp:
- 06/13/13 13:43:39 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.0-beta1/include/Pacpus/kernel/inputOutputBase.h
r102 r110 60 60 //TODO get event Type anf call callback function 61 61 62 PacpusEvent * event = dynamic_cast<PacpusEvent *>(e); 62 63 QByteArray buf; 63 64 QDataStream out(&buf,QIODevice::WriteOnly); 64 out << e;65 event->streamOut(out); 65 66 // Callback QByteArray 66 67 } 67 68 68 69 void setReadingMode(ReadingMode mode) { readingMode_ = mode;} 69 virtual PacpusEvent getEventTemplate() {returnPacpusEvent(GENERIC_EVENT);} // TODO check ??70 virtual PacpusEvent* getEventTemplate() {return new PacpusEvent(GENERIC_EVENT);} // TODO check ?? 70 71 protected: 71 72 ReadingMode readingMode_; 73 private: 74 // metode(QByteArray) 75 76 //QQueue jobQueue_; 72 77 }; 73 78 … … 89 94 90 95 void send(/*const*/ QByteArray & data) { 96 // TODO check at least one Typed connection 91 97 92 // TODo getEvent 93 //PacpusEvent& event = _connection.at(0).getInterface()-> 94 QDataStream in(&data,QIODevice::ReadOnly); 95 //in >> event; 96 97 //for(QList<ConnectionBase>::iterator it = _connection.begin(); it!=_connection.end(); ++it) 98 // QApplication::postEvent(it->getInterface(),&event,it->getPriority()); 98 for(QList<ConnectionBase>::iterator it = _connection.begin(); it!=_connection.end(); ++it){ 99 QDataStream in(&data,QIODevice::ReadOnly); 100 PacpusEvent* event = dynamic_cast<InputInterfaceBase*>(_connection.at(0).getInterface())->getEventTemplate(); 101 event->streamIn(in); 102 QApplication::postEvent(it->getInterface(),event,it->getPriority()); 103 } 99 104 100 105 … … 103 108 }; 104 109 105 static bool connectInterface(OutputInterfaceBase* out, InputInterfaceBase * in, int priority )110 static bool connectInterface(OutputInterfaceBase* out, InputInterfaceBase * in, int priority, InputInterfaceBase::ReadingMode mode = InputInterfaceBase::GetLast) 106 111 { 107 112 if(out->getDataType() == in->getDataType() || out->getDataType() == QString(typeid(QByteArray).name()) || in->getDataType() == QString(typeid(QByteArray).name())) { … … 110 115 out->addConnection(ConnectionBase(in,priority)); // TODO make connect function 111 116 in->addConnection(ConnectionBase(out,priority)); 117 in->setReadingMode(mode); 112 118 //LOG_INFO("connection : Output " << out->getSignature() << " => Input " << in->getSignature()); 113 in->setReadingMode(InputInterfaceBase::NeverSkip);114 119 return true; 115 120 } else {
Note:
See TracChangeset
for help on using the changeset viewer.