Clean up configure/build-process.

- assume C++ standard-conforming environment
- add a user-option for gnuplot-support
- separate gnuplot-code into declaration and implementation,
  so we can define at EO-build-time whether to use it or not.

Adopt code and Makefiles to above changes.

Some minor fixes.
This commit is contained in:
kuepper 2005-10-02 21:42:08 +00:00
commit 47af7cfe5a
22 changed files with 603 additions and 537 deletions

View file

@ -23,100 +23,51 @@
mkeijzer@dhi.dk
*/
//-----------------------------------------------------------------------------
#ifndef NO_GNUPLOT
#ifndef _eoGnuplot1DMonitor_H
#define _eoGnuplot1DMonitor_H
#ifndef EO_eoGnuplot1DMonitor_H
#define EO_eoGnuplot1DMonitor_H
#include <fstream>
#include <string>
#include <utils/eoMonitor.h>
#include <utils/eoGnuplot.h>
#include <eoObject.h>
#include "eoObject.h"
#include "utils/eoFileMonitor.h"
#include "utils/eoGnuplot.h"
#include "utils/pipecom.h"
/**
@author Marc Schoenauer 2000
@version 0.0
/** Plot eoStat
@author Marc Schoenauer
@version 0.0 (2000)
This class plots through gnuplot the eoStat given as argument
eoGnuplot1DMonitor plots stats through gnuplot
Assumes that the same file is appened every so and so, and replots it
everytime
*/
//-----------------------------------------------------------------------------
#include <fstream>
#include <utils/pipecom.h>
/** eoGnuplot1DMonitor plots stats through gnuplot
* assumes that the same file is appened every so and so,
* and replots it everytime
*/
class eoGnuplot1DMonitor: public eoFileMonitor, public eoGnuplot
class eoGnuplot1DMonitor : public eoFileMonitor, public eoGnuplot
{
public:
// Ctor
eoGnuplot1DMonitor(std::string _filename, bool _top=false) :
eoFileMonitor(_filename, " "),
eoGnuplot(_filename,(_top?"":"set key bottom"))
{}
public:
using eoMonitor::vec;
// Dtor
virtual ~eoGnuplot1DMonitor(){}
/** Constructor */
eoGnuplot1DMonitor(std::string _filename, bool _top=false) :
eoFileMonitor(_filename, " "),
eoGnuplot(_filename,(_top?"":"set key bottom"))
{}
virtual eoMonitor& operator() (void) ;
virtual void FirstPlot();
/** Destructor */
virtual ~eoGnuplot1DMonitor(){}
/// Class name.
virtual std::string className() const { return "eoGnuplot1DMonitor"; }
virtual eoMonitor& operator()();
private:
virtual void FirstPlot();
/** Class name */
virtual std::string className() const
{ return "eoGnuplot1DMonitor"; }
};
// the following should be placed in a separate eoGnuplot1DMonitor.cpp
// then the inline specifier should dissappear
////////////////////////////////////////////////////////////
inline eoMonitor& eoGnuplot1DMonitor::operator() (void)
/////////////////////////////////////////////////////////
{
// update file using the eoFileMonitor
eoFileMonitor::operator()();
// sends plot order to gnuplot
// assumes successive plots will have same nb of columns!!!
if (firstTime)
{
FirstPlot();
firstTime = false;
}
else
{
if( gpCom ) {
PipeComSend( gpCom, "replot\n" );
}
}
return *this;
}
////////////////////////////////////////////////////////////
inline void eoGnuplot1DMonitor::FirstPlot()
////////////////////////////////////////////////////////
{
if (vec.size() < 2)
{
throw std::runtime_error("Must have some stats to plot!\n");
}
std::ostringstream os;
os << "plot";
for (unsigned i=1; i<vec.size(); i++) {
os << " '" << getFileName().c_str() <<
"' using 1:" << i+1 << " title '" << vec[i]->longName() << "' with lines" ;
if (i<vec.size()-1)
os << ", ";
}
os << '\n';
PipeComSend( gpCom, os.str().c_str());
}
#endif
#endif