00001 /*************************************************************************** 00002 * SpikeStream Application * 00003 * Copyright (C) 2007 by David Gamez * 00004 * david@davidgamez.eu * 00005 * Version 0.1 * 00006 * * 00007 * This program is free software; you can redistribute it and/or modify * 00008 * it under the terms of the GNU General Public License as published by * 00009 * the Free Software Foundation; either version 2 of the License, or * 00010 * (at your option) any later version. * 00011 * * 00012 * This program is distributed in the hope that it will be useful, * 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00015 * GNU General Public License for more details. * 00016 * * 00017 * You should have received a copy of the GNU General Public License * 00018 * along with this program; if not, write to the * 00019 * Free Software Foundation, Inc., * 00020 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00021 ***************************************************************************/ 00022 00023 #ifndef MONITORDATASET_H 00024 #define MONITORDATASET_H 00025 00026 //Qwt includes 00027 #include "qwt_data.h" 00028 00029 00030 //------------------------- Monitor Dataset -------------------------------- 00031 /*! Holds the data for the graphs of neuron and synapse data that are 00032 displayed by the NeuronMonitor and SynapseMonitor. 00033 Implements scrolling of the data so that latest elements overwrite 00034 earlier ones. 00035 00036 NOTE: All the data variables are pointers so that a copy can be made and 00037 the new class is updated in sync with the old one. It is done this way 00038 because QwtPlot calls copy method, but want to keep refernce to original 00039 class and update the original class before plotting. */ 00040 //-------------------------------------------------------------------------- 00041 00042 class MonitorDataset : public QwtData { 00043 00044 public: 00045 MonitorDataset(int bufSize, double rangeL, double rangeH); 00046 MonitorDataset(); 00047 ~MonitorDataset(); 00048 void addPoint(double xVal, double yVal); 00049 QwtDoubleRect boundingRect() const; 00050 QwtDoubleRect* boundingRectRef() const; 00051 void cleanUp(); 00052 MonitorDataset* copy() const; 00053 size_t size() const; 00054 double x(size_t i) const; 00055 double y(size_t i) const; 00056 00057 00058 private: 00059 //==================================== VARIABLES =================================== 00060 /*! Array holding the X data.*/ 00061 double* xArray; 00062 00063 /*! Array holding the Y data.*/ 00064 double* yArray; 00065 00066 /*! Position at which data is added in the array. It is a circular buffer.*/ 00067 int* insertPos; 00068 00069 /*! Size of the circular buffer.*/ 00070 int* bufferSize; 00071 00072 /*! How much the x axis increases with each additional point. This is to manage 00073 scrolling behaviour of the bounds rectangle.*/ 00074 double* xIncrement; 00075 00076 /*! Previous X value.*/ 00077 double* xOld; 00078 00079 /*! Minimum Y value.*/ 00080 double* yMin; 00081 00082 /*! Maximum Y value.*/ 00083 double* yMax; 00084 00085 /*! When the buffer is full start scrolling behaviour.*/ 00086 bool* bufferFull; 00087 00088 /*! The bounds of the data. */ 00089 QwtDoubleRect* bndRect; 00090 00091 00092 //=================================== METHODS ===================================== 00093 /*! Declare copy constructor private so it cannot be used inadvertently.*/ 00094 MonitorDataset (const MonitorDataset&); 00095 00096 /*! Declare assignment private so it cannot be used inadvertently.*/ 00097 MonitorDataset operator = (const MonitorDataset&); 00098 00099 }; 00100 00101 00102 #endif//MONITORDATASET_H
1.4.4