pelican/examples/tutorial/src/OutputStreamExample.cpp
// Sends the data blob to the output stream.
Sends the data blob to the output stream.
Sends the data blob to the output stream .
void OutputStreamExample::sendStream(const QString& ,
        const DataBlob* blob)
{
    if (blob->type() != "SignalData") return;
    const float* data = ((const SignalData*)blob)->ptr();
    unsigned size = ((const SignalData*)blob)->size();
    if (data)
    {
        QString csv = QString::number(data[0]);
        for (unsigned i = 1; i < size; ++i) {
            csv += "," + QString::number(data[i]);
        }
        foreach (QIODevice* device, _devices) {
            QTextStream out(device);
            out << csv << endl;
        }
    }
}
void OutputStreamExample :: sendStream ( const QString & , const DataBlob * blob ) { if ( blob -> type ( ) != " " ) return ; const float * data = ( ( const SignalData * ) blob ) -> ptr ( ) ; unsigned size = ( ( const SignalData * ) blob ) -> size ( ) ; if ( data ) { QString csv = QString :: number ( data [ 0 ] ) ; for ( unsigned i = 1 ; i < size ; ++ i ) { csv += " " + QString :: number ( data [ i ] ) ; } foreach ( QIODevice * device , _devices ) { QTextStream out ( device ) ; out << csv << endl ; } } }
Sends the data blob to the output stream.
Sends the data blob to the output stream .
/*streamName*/ // Check it's a data blob type we know how to use. // Construct the comma separated value string. // Output the string to each file