Esempio n. 1
0
    void ProcessData(const T *Values,
                     typename ValueArray::size_type Size,
                     FnWriter pfnWriter,
                     FnReader pfnReader)
    {
        ValueArray InValues(Size);

        {
            wxFileOutputStream FileOutput( wxT("mytext.dat") );
            wxDataOutputStream DataOutput( FileOutput );

            (DataOutput.*pfnWriter)(Values, Size);
        }

        {
            wxFileInputStream FileInput( wxT("mytext.dat") );
            wxDataInputStream DataInput( FileInput );

            (DataInput.*pfnReader)(&*InValues.begin(), InValues.size());
        }

        m_ok = true;
        for (typename ValueArray::size_type idx=0; idx!=Size; ++idx) {
            if (InValues[idx]!=Values[idx]) {
                m_ok = false;
                break;
            }
        }
    }
Esempio n. 2
0
MainWindow::MainWindow(QWidget *parent, Qt::WFlags flags)
	: QMainWindow(parent, flags)
{
	ui.setupUi(this);
	cntPkt = cntErr = cntWtf = 0;
	QObject::connect(ui.portOpenButton, SIGNAL(clicked()),this, SLOT(openPort()));
	QObject::connect(ui.portCloseButton, SIGNAL(clicked()),this, SLOT(closePort()));
	QObject::connect(ui.nodeSettingsSetButton, SIGNAL(clicked()),this, SLOT(nodeUpdateSettings()));
	QObject::connect(&port, SIGNAL(DataReceived(quint64)),this, SLOT(DataInput(quint64)));
	QObject::connect(&timer, SIGNAL(timeout()),this, SLOT(timeout()));


	QStringList ports = port.EnumeratePorts();
	ports.sort();
	ui.portSelectCombo->insertItems(0, ports);

	nodeUpdateSettings();
	//timer.setInterval(1);//in fact it should be ~230usec
	//port.SetReadTimeout(1);//and still to much
}
Esempio n. 3
0
static
T TestRW(const T &Value)
{
    T InValue;

    {
        wxFileOutputStream FileOutput( wxT("mytext.dat") );
        wxDataOutputStream DataOutput( FileOutput );

        DataOutput << Value;
    }

    {
        wxFileInputStream FileInput( wxT("mytext.dat") );
        wxDataInputStream DataInput( FileInput );

        DataInput >> InValue;
    }

    return InValue;
}