Changeset 185 in pacpusframework for trunk/include


Ignore:
Timestamp:
Oct 23, 2013, 10:32:21 AM (11 years ago)
Author:
morasjul
Message:

Fixed: dependencies.

Location:
trunk/include/Pacpus/kernel
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/Pacpus/kernel/InputOutputBase.h

    r182 r185  
    6666    virtual ~InputInterfaceBase();
    6767
    68     virtual void customEvent(QEvent* e);
     68    virtual void customEvent(QEvent * e);
    6969
    7070    ReadingMode & readingMode();
    71     const ReadingMode & readingMode() const;
     71    const ReadingMode & getReadingMode() const;
    7272    void setReadingMode(ReadingMode mode);
    7373
     
    9696    QStringList getInputConnectedList();
    9797
    98     // TODO for serialization prupose (not yet implemented !!!)
    9998    void send(/*const*/ QByteArray & data);
    10099};
    101 
    102 namespace {
    103 
    104 bool connectInterface(OutputInterfaceBase * out, InputInterfaceBase * in, int priority, InputInterfaceBase::ReadingMode mode = InputInterfaceBase::GetLast);
    105 
    106 bool connectInterface(OutputInterfaceBase * out, InputInterfaceBase * in, int priority, InputInterfaceBase::ReadingMode mode)
    107 {
    108     if (out->getDataType() == in->getDataType() || out->getDataType() == QString(typeid(QByteArray).name()) || in->getDataType() == QString(typeid(QByteArray).name())) {
    109         // Add connection
    110         out->addConnection(ConnectionBase(in, priority));  // TODO make connect function
    111         in->addConnection(ConnectionBase(out, priority));
    112         in->setReadingMode(mode);
    113         //LOG_INFO("connection : Output " << out->getSignature() << " => Input " << in->getSignature());
    114         return true;
    115     } else {
    116         //LOG_WARN("connecting " << out->getSignature() << ":" << out->getDataType() << " to " << in->getSignature() << ":" << in->getDataType() << " failled : DataType incompatible " <<  QString(typeid(QByteArray).name()));
    117         return false;
    118     }
    119 }
    120 
    121 } // namespace
    122100
    123101} // namespace pacpus
  • trunk/include/Pacpus/kernel/InputOutputInterface.h

    r184 r185  
    9696
    9797    // TODO for Pulling mode (not yet implemented !!!)
    98     T& getData() {
     98    T & getData() {
    9999        T data;
    100100        // TODO ask output data;
     
    105105protected:
    106106    void (C::*method)(const T&);
    107 
    108107};
    109108
    110109template <typename T, class C>
    111 class OutputInterface : public OutputInterfaceBase
     110class OutputInterface
     111    : public OutputInterfaceBase
    112112{
    113113public:
    114114    OutputInterface(QString name, C * component)
    115         :OutputInterfaceBase(name,component,component)
     115        : OutputInterfaceBase(name, component, component)
    116116    {}
    117117    ~OutputInterface() {}
     
    120120    void send(const T & data, road_time_t t = road_time(), road_timerange_t tr = 0);
    121121   
    122     void send(const T & data, road_time_t t, road_timerange_t tr)
    123     {
    124         // FIXME Data Shared
    125         //QSharedPointer<T> sharedPointer = new T(data);
    126 
    127         for (QList<ConnectionBase>::iterator it = connections().begin(); it != connections().end(); ++it) {
    128             QApplication::postEvent(it->getInterface(),new PacpusTypedEvent<T>(TYPED_EVENT,data,t,tr),it->getPriority()); // Event is delete by the event loop handler
    129             //qDebug() << "sender " << it->getInterface()->getSignature() <<  " thread " << QThread::currentThread() << " Data & " << &data << " ";
    130         }
    131     }
    132 
    133122    size_t getDataSize()
    134123    {
     
    142131};
    143132
     133template <typename T, class C>
     134void OutputInterface<T, C>::send(const T & data, road_time_t t, road_timerange_t tr)
     135{
     136    // FIXME Data Shared
     137    //QSharedPointer<T> sharedPointer = new T(data);
     138
     139    for (QList<ConnectionBase>::iterator it = connections().begin(); it != connections().end(); ++it) {
     140        QApplication::postEvent(it->getInterface(),new PacpusTypedEvent<T>(TYPED_EVENT,data,t,tr),it->getPriority()); // Event is delete by the event loop handler
     141        //qDebug() << "sender " << it->getInterface()->getSignature() <<  " thread " << QThread::currentThread() << " Data & " << &data << " ";
     142    }
     143}
     144
    144145} // namespace pacpus
    145146
Note: See TracChangeset for help on using the changeset viewer.