ACQ2XX_API
DataStreamer.h
Go to the documentation of this file.
00001 /* ------------------------------------------------------------------------- */
00002 /* file DataStreamer.h                                                       */
00003 /* ------------------------------------------------------------------------- */
00004 /*   Copyright (C) 2009 Peter Milne, D-TACQ Solutions Ltd
00005  *                      <Peter dot Milne at D hyphen TACQ dot com>
00006 
00007  This program is free software; you can redistribute it and/or modify
00008  it under the terms of Version 2 of the GNU General Public License
00009  as published by the Free Software Foundation;
00010 
00011  This program is distributed in the hope that it will be useful,
00012  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  GNU General Public License for more details.
00015 
00016  You should have received a copy of the GNU General Public License
00017  along with this program; if not, write to the Free Software
00018  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                */
00019 /* ------------------------------------------------------------------------- */
00020 
00021 /** @file DataStreamer.h continuous data streaming handler.
00022  *
00023 <pre>
00024   opts:
00025 </pre>
00026  */
00027 
00028 #ifndef __DATA_STREAMER_H__
00029 #define __DATA_STREAMER_H__
00030 
00031 class FrameHandler {
00032 public:
00033         virtual ~FrameHandler() {}
00034 
00035         virtual void onFrame(
00036                         Acq2xx& _card, const AcqType& _acqType,
00037                         const Frame* frame) = 0;
00038 };
00039 
00040 class DataStreamer {
00041 
00042 protected:
00043         Acq2xx& card;
00044         const AcqType& acqType;
00045 
00046         DataStreamer(
00047                 Acq2xx& _card, 
00048                 const AcqType& _acqType) :
00049                 card(_card), acqType(_acqType)
00050         {}
00051 public:
00052         virtual ~DataStreamer() {}
00053 
00054         virtual int streamData() = 0;
00055 
00056         static DataStreamer* create(Acq2xx& card, const AcqType& acqType);
00057         static FrameHandler* createMeanHandler(
00058                 const AcqType& acqType, bool format_hex = 0);
00059         static FrameHandler* createTagHandler(int detail);
00060         static FrameHandler* createNewlineHandler();
00061 
00062         virtual int addFrameHandler(FrameHandler *handler) = 0;
00063         virtual int delFrameHandler(FrameHandler *handler) = 0;
00064 };
00065 
00066 #endif // __DATA_STREAMER_H__