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 MONITORXMLHANDLER_H 00024 #define MONITORXMLHANDLER_H 00025 00026 //SpikeStream includes 00027 #include "MonitorDataPlotter.h" 00028 00029 //Qt includes 00030 #include <qxml.h> 00031 #include <qstring.h> 00032 00033 00034 //------------------------- Monitor XML Handler --------------------------- 00035 /*! Unpacks the description of data sent by neuron or synapse classes and 00036 uses it to create new graphs. */ 00037 //------------------------------------------------------------------------- 00038 00039 class MonitorXmlHandler : public QXmlDefaultHandler { 00040 00041 public: 00042 MonitorXmlHandler(MonitorDataPlotter*); 00043 ~MonitorXmlHandler(); 00044 bool getParseError(); 00045 QString getParseErrorString(); 00046 00047 protected: 00048 //Inherited parsing methods 00049 bool characters ( const QString & ch ); 00050 bool endElement( const QString&, const QString&, const QString& ); 00051 bool startDocument(); 00052 bool startElement( const QString&, const QString&, const QString& , const QXmlAttributes& ); 00053 00054 //Inherited error handling methods 00055 bool error ( const QXmlParseException & exception ); 00056 QString errorString (); 00057 bool fatalError ( const QXmlParseException & exception ); 00058 bool warning ( const QXmlParseException & exception ); 00059 00060 00061 private: 00062 //========================== VARIABLES ================================ 00063 /*! Stores the current element. */ 00064 QString currentElement; 00065 00066 /*! Reference to the Neuron Monitor that this class is loading data for.*/ 00067 MonitorDataPlotter *monitorDataPlotter; 00068 00069 /*! NeuronGroup used to hold information about the neuron group 00070 as it is parsed. */ 00071 NewGraph newGraph; 00072 00073 /*! Records whether there has been an error during parsing. */ 00074 bool parseError; 00075 00076 /*! Error messages generated during parsing. */ 00077 QString parseErrorString; 00078 00079 00080 //=========================== METHODS ================================= 00081 /*! Declare copy constructor private so it cannot be used inadvertently. */ 00082 MonitorXmlHandler (const MonitorXmlHandler&); 00083 00084 /*! Declare assignment private so it cannot be used inadvertently.*/ 00085 MonitorXmlHandler operator = (const MonitorXmlHandler&); 00086 00087 }; 00088 00089 00090 #endif //MONITORXMLHANDLER_H 00091 00092
1.4.4