Changeset 153 in pacpusframework for branches/2.0-beta1/include


Ignore:
Timestamp:
Aug 1, 2013, 11:42:22 AM (11 years ago)
Author:
Marek Kurdej
Message:

Fixed: C4996 unchecked iterator warning on MSVC.

Location:
branches/2.0-beta1/include/Pacpus/kernel
Files:
4 edited

Legend:

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

    r102 r153  
    1 #ifndef ConnectionBase_H
    2 #define ConnectionBase_H
     1#ifndef CONNECTIONBASE_H
     2#define CONNECTIONBASE_H
    33
    44#include <Pacpus/kernel/pacpus.h>
     
    1111{
    1212public:
    13     ConnectionBase(AbstractInterface * interface, int priority):_interface(interface),_priority(priority) {}
    14     ~ConnectionBase() {}
     13    ConnectionBase(AbstractInterface * interface, int priority)
     14        : m_interface(interface)
     15        , m_priority(priority)
     16    {}
    1517
    16     AbstractInterface *  getInterface() const {return _interface;}
    17     int getPriority() const {return _priority;}
     18    ~ConnectionBase()
     19    {}
    1820
    19     bool operator== (ConnectionBase const &c) {
    20         return _interface == c.getInterface() && _priority == c.getPriority();}
     21    AbstractInterface *  getInterface() const
     22    {
     23        return m_interface;
     24    }
     25
     26    int getPriority() const
     27    {
     28        return m_priority;
     29    }
     30
     31    bool operator==(ConnectionBase const &c)
     32    {
     33        return getInterface() == c.getInterface()
     34            && getPriority() == c.getPriority()
     35            ;
     36    }
    2137
    2238private:
    23     AbstractInterface * _interface;
    24     int _priority;
     39    AbstractInterface * m_interface;
     40    int m_priority;
    2541};
    2642
    2743} // namespace pacpus
    2844
    29 #endif // ConnectionBase_H
     45#endif // CONNECTIONBASE_H
  • branches/2.0-beta1/include/Pacpus/kernel/InputOutputBase.h

    r152 r153  
    22#define IN_OUT_BASE_H
    33
     4#include <Pacpus/kernel/Log.h>
    45#include <Pacpus/kernel/pacpus.h>
    56#include <Pacpus/kernel/ConnectionBase.h>
     
    2627        , m_component(component)
    2728        , QObject(parent)
    28     {}
     29    {
     30        LOG_DEBUG("constructing abstract connection '" << getName() << "'");
     31    }
    2932
    3033    ~AbstractInterface()
  • branches/2.0-beta1/include/Pacpus/kernel/InputOutputInterface.h

    r152 r153  
    55#include <Pacpus/kernel/InputOutputBase.h>
    66#include <QApplication>
     7#include <QByteArray>
     8#include <QThread>
    79#include <typeinfo>
    8 
    9 #include <QDebug>
    10 #include <QThread>
    11 
    12 #include <QByteArray>
    13 
    14 //#define ADD_INPUT(name, ComponentType, DataType, functionName) \
    15 //    inputs().insert((name), new InputInterface<DataType, ComponentType> ((name), this, &ComponentType::functionName))
    16 //#define ADD_OUTPUT(name, ComponentType, DataType) \
    17 //    outputs().insert((name), new OutputInterface<DataType, ComponentType> ((name), this))
    18 
    19 //#define GET_INPUT(name, ComponentType, DataType) \
    20 //    dynamic_cast<InputInterface<DataType, ComponentType> *> (input.value(name))
    21 //#define GET_OUTPUT(name, ComponentType, DataType) \
    22 //    dynamic_cast<OutputInterface<DataType, ComponentType> *> (output.value(name))
    2310
    2411namespace pacpus {
     
    6148            PacpusTypedEvent<T> * typedEvent = dynamic_cast<PacpusTypedEvent<T> *> (event);
    6249
    63             //qDebug() << "Reciever " << getSignature() << " thread " << QThread::currentThread() << " Data & " << & typedEvent->data_;
     50            LOG_DEBUG("Receiver " << getSignature() << " thread " << QThread::currentThread() << " Data & " << & typedEvent->data_);
    6451
    6552            //if(_component) get state
    6653
    6754            if (typedEvent->timerange() < 500 && readingMode() == TimeBounded) {
    68                 //LOG_WARN("Incorrect TimeRange (0), switch to NeverSkip");
    69                 qDebug() << "Incorrect TimeRange (0), switch to NeverSkip";
    70                 readingMode() = NeverSkip;}
     55                LOG_WARN("Incorrect TimeRange (0), switch to NeverSkip");
     56                readingMode() = NeverSkip;
     57            }
    7158
    7259            switch (readingMode()) {
    7360            case TimeBounded:
    74                 //qDebug() << "Input " << this->getSignature().leftJustified(20) << QString("Time bournded").leftJustified(15) << road_time()- typedEvent->t_ << "\t" << typedEvent->tr_;
     61                LOG_DEBUG("Input " << this->getSignature().leftJustified(20) << QString("Time bournded").leftJustified(15) << road_time()- typedEvent->t_ << "\t" << typedEvent->tr_);
    7562
    7663                if (road_time() - typedEvent->time() > typedEvent->timerange()) {
    77                     qDebug() << "Data skip " << this->getSignature();
     64                    LOG_DEBUG("Data skip " << this->getSignature());
    7865                    break;
    7966                }
     
    8370
    8471            case GetLast:
    85                 //qDebug() << "Input " << this->getSignature().leftJustified(20) << QString("GetLast").leftJustified(15) << road_time() - typedEvent->t_ << "\t" << typedEvent->tr_;
     72                LOG_DEBUG("Input " << this->getSignature().leftJustified(20) << QString("GetLast").leftJustified(15) << road_time() - typedEvent->t_ << "\t" << typedEvent->tr_);
    8673
    8774                (dynamic_cast<C*>(component())->*method)(typedEvent->data());
    88                 QCoreApplication::removePostedEvents(this,TYPED_EVENT); // delete all remining events
     75                // delete all remaining events
     76                QCoreApplication::removePostedEvents(this, TYPED_EVENT);
    8977                break;
    9078
    9179            case NeverSkip:
    92                 //qDebug() << "Input " << this->getSignature().leftJustified(20) << QString("NeverSkip").leftJustified(15) << road_time() - typedEvent->t_ << "\t" << typedEvent->tr_;
     80                LOG_DEBUG("Input " << this->getSignature().leftJustified(20) << QString("NeverSkip").leftJustified(15) << road_time() - typedEvent->t_ << "\t" << typedEvent->tr_);
    9381
    9482            default:
     
    118106
    119107        default:
    120 
    121             qDebug() << "Unknown event ID " << event->type();
     108            LOG_WARN("Unknown event ID " << event->type());
    122109            break;
    123110        }
     
    152139
    153140    // Used by Components to send data througth typed output
    154     void send(const T & data, road_time_t t = road_time(), road_timerange_t tr = 0) {
    155 
     141    void send(const T & data, road_time_t t = road_time(), road_timerange_t tr = 0)
     142    {
    156143        //QSharedPointer<T> sharedPointer = new T(data);
    157144
    158         for(QList<ConnectionBase>::iterator it = connections().begin(); it != connections().end(); ++it){
     145        for (QList<ConnectionBase>::iterator it = connections().begin(); it != connections().end(); ++it) {
    159146            QApplication::postEvent(it->getInterface(),new PacpusTypedEvent<T>(TYPED_EVENT,data,t,tr),it->getPriority()); // Event is delete by the event loop handler
    160147            //qDebug() << "sender " << it->getInterface()->getSignature() <<  " thread " << QThread::currentThread() << " Data & " << &data << " ";
  • branches/2.0-beta1/include/Pacpus/kernel/PacpusEvent.h

    r150 r153  
    139139    {
    140140        m_data = new char[m_dataSize];
    141         ::std::copy(data, data + m_dataSize, m_data);
     141        ::std::copy(data, data + m_dataSize, // source
     142#ifdef _MSC_VER
     143            ::stdext::checked_array_iterator<char *>(m_data, m_dataSize) // destination
     144#else
     145            m_data // destination
     146#endif
     147            );
    142148    }
    143149
Note: See TracChangeset for help on using the changeset viewer.