Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | Related Pages | Search for

# eoGnuplot1DSnapshot.h

    00001 // -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
    00002
    00003 //-----------------------------------------------------------------------------
    00004 // eoGnuplot1DSnapshot.h
    00005 // (c) Marc Schoenauer, Maarten Keijzer and GeNeura Team, 2000
    00006 /*
    00007    This library is free software; you can redistribute it and/or
    00008    modify it under the terms of the GNU Lesser General Public
    00009    License as published by the Free Software Foundation; either
    00010    version 2 of the License, or (at your option) any later version.
    00011
    00012    This library 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 GNU
    00015    Lesser General Public License for more details.
    00016
    00017    You should have received a copy of the GNU Lesser General Public
    00018    License along with this library; if not, write to the Free Software
    00019    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    00020
    00021    Contact: todos@geneura.ugr.es, http://geneura.ugr.es
    00022              Marc.Schoenauer@inria.fr
    00023              mkeijzer@dhi.dk
    00024  */
    00025 //-----------------------------------------------------------------------------
    00026
    00027
    00028 #ifndef EO_eoGnuplot1DSnapshot_H
    00029 #define EO_eoGnuplot1DSnapshot_H
    00030
    00031 #include <fstream>
    00032 #include <sstream>
    00033 #include <string>
    00034
    00035 #include <eoObject.h>
    00036 #include "eoRealVectorBounds.h"
    00037 #include <utils/pipecom.h>
    00038 #include <utils/eoFileSnapshot.h>
    00039 #include <utils/eoGnuplot.h>
    00040
    00051 class eoGnuplot1DSnapshot: public eoFileSnapshot, public eoGnuplot
    00052 {
    00053  public:
    00054     // Ctor
    00055   eoGnuplot1DSnapshot(std::string _dirname, unsigned _frequency = 1,
    00056                       std::string _filename = "gen", std::string _delim = " ",
    00057                       unsigned _counter = 0, bool _rmFiles = true) :
    00058       eoFileSnapshot(_dirname, _frequency, _filename, _delim, _counter, _rmFiles),
    00059       eoGnuplot(_filename,"set data style points"),
    00060       pointSize(5)
    00061   {}
    00062
    00063     // Ctor
    00064   eoGnuplot1DSnapshot(std::string _dirname,  eoRealVectorBounds & _bounds,
    00065                        unsigned _frequency = 1, std::string _filename = "gen",
    00066                        std::string _delim = " ", unsigned _counter = 0, bool _rmFiles = true ) :
    00067       eoFileSnapshot(_dirname, _frequency, _filename, _delim, _counter, _rmFiles),
    00068       eoGnuplot(_filename,"set data style points"),
    00069       pointSize(5)
    00070   {
    00071     handleBounds(_bounds);
    00072   }
    00073     // Ctor
    00074   eoGnuplot1DSnapshot(eoFileSnapshot & _fSnapshot) :
    00075       eoFileSnapshot(_fSnapshot),
    00076       eoGnuplot(_fSnapshot.baseFileName(),"set data style points"),
    00077       pointSize(5)
    00078   {}
    00079
    00080     // Ctor with range
    00081   eoGnuplot1DSnapshot(eoFileSnapshot & _fSnapshot, eoRealVectorBounds & _bounds) :
    00082       eoFileSnapshot(_fSnapshot),
    00083       eoGnuplot(_fSnapshot.baseFileName(),"set data style points"),
    00084       pointSize(5)
    00085   {
    00086     handleBounds(_bounds);
    00087   }
    00088
    00089   // Dtor
    00090   virtual ~eoGnuplot1DSnapshot(){}
    00091
    00092   virtual eoMonitor& operator()();
    00093
    00095   virtual std::string className() const { return "eoGnuplot1DSnapshot"; }
    00096
    00097   virtual void handleBounds(eoRealVectorBounds & _bounds)
    00098   {
    00099       std::ostringstream os;
    00100       os << "set autoscale\nset yrange [" ;
    00101       if (_bounds.isMinBounded(0))
    00102           os << _bounds.minimum(0);
    00103       os << ":" ;
    00104       if (_bounds.isMaxBounded(0))
    00105           os << _bounds.maximum(0);
    00106       os << "]\n";
    00107       gnuplotCommand(os.str());
    00108   }
    00109
    00110   void setPointSize(unsigned  _pointSize)
    00111   { pointSize = _pointSize; }
    00112
    00113 protected:
    00114
    00115     unsigned pointSize;
    00116 };
    00117
    00118
    00119 #endif