Ignore:
Timestamp:
06/13/13 13:43:39 (11 years ago)
Author:
morasjul
Message:

Beta-2 : Fix CMakeList (link), remove useless code and add improvement

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.0-beta1/include/Pacpus/kernel/inputOutputBase.h

    r102 r110  
    6060            //TODO get event Type anf call callback function
    6161
     62            PacpusEvent * event = dynamic_cast<PacpusEvent *>(e);
    6263    QByteArray buf;
    6364    QDataStream out(&buf,QIODevice::WriteOnly);
    64     out << e;
     65    event->streamOut(out);
    6566    // Callback QByteArray
    6667    }
    6768
    6869    void setReadingMode(ReadingMode mode) { readingMode_ = mode;}
    69     virtual PacpusEvent getEventTemplate() {return PacpusEvent(GENERIC_EVENT);} // TODO check ??
     70    virtual PacpusEvent* getEventTemplate() {return new PacpusEvent(GENERIC_EVENT);} // TODO check ??
    7071protected:
    7172            ReadingMode readingMode_;
     73private:
     74        // metode(QByteArray)
     75
     76        //QQueue jobQueue_;
    7277};
    7378
     
    8994
    9095    void send(/*const*/ QByteArray & data) {
     96        // TODO check at least one Typed connection
    9197
    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        }
    99104
    100105
     
    103108};
    104109
    105 static bool connectInterface(OutputInterfaceBase* out, InputInterfaceBase * in, int priority)
     110static bool connectInterface(OutputInterfaceBase* out, InputInterfaceBase * in, int priority, InputInterfaceBase::ReadingMode mode = InputInterfaceBase::GetLast)
    106111{
    107112    if(out->getDataType() == in->getDataType() || out->getDataType() == QString(typeid(QByteArray).name()) || in->getDataType() == QString(typeid(QByteArray).name())) {
     
    110115        out->addConnection(ConnectionBase(in,priority));  // TODO make connect function
    111116        in->addConnection(ConnectionBase(out,priority));
     117        in->setReadingMode(mode);
    112118        //LOG_INFO("connection : Output " << out->getSignature() << " => Input " << in->getSignature());
    113                 in->setReadingMode(InputInterfaceBase::NeverSkip);
    114119        return true;
    115120    } else {
Note: See TracChangeset for help on using the changeset viewer.