Changeset 107 for trunk/lib/Gnuplot.h


Ignore:
Timestamp:
Jun 28, 2006, 11:12:38 AM (15 years ago)
Author:
Peter Johansson
Message:

Gnuplot functions returning int and utilizing that in the test. However the warning sent from Gnuplot ref #37 is not caught since there is no problem with the pipe there.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Gnuplot.h

    r101 r107  
    3333#include <vector>
    3434
     35
     36#include <iostream>
    3537
    3638namespace theplu {
     
    7072    /// Send arbitrary commands to Gnuplot.
    7173    ///
     74    /// @return 0 if fputs, fputc, and fflush are succesful
     75    ///
    7276    int command(const std::string&);
    7377
     
    9397    /// Gnuplot usage.
    9498    ///
     99    /// @return whatever command() returns
     100    ///
    95101    template <class T1, class T2>
    96     void plot(const std::vector<T1>& y, const std::vector<T2>& x)
    97     { plot(y,x,"plot"); }
     102    int plot(const std::vector<T1>& y, const std::vector<T2>& x)
     103    { return plot(y,x,"plot"); }
    98104
    99105    template <class T1>
    100     void plot(const std::vector<T1>& y,
     106    int plot(const std::vector<T1>& y,
    101107              const std::vector<T1>& x=std::vector<T1>())
    102     { plot(y,x,"plot"); }
     108    { return plot(y,x,"plot"); }
    103109
    104110    ///
     
    107113    /// Gnuplot usage.
    108114    ///
     115    /// @return whatever command() returns
     116    ///
    109117    template <class T1, class T2>
    110     void replot(const std::vector<T1>& y, const std::vector<T2>& x)
    111     { plot(y,x,"replot"); }
     118    int replot(const std::vector<T1>& y, const std::vector<T2>& x)
     119    { return plot(y,x,"replot"); }
    112120
    113121    template <class T1>
    114     void replot(const std::vector<T1>& y,
     122    int replot(const std::vector<T1>& y,
    115123              const std::vector<T1>& x=std::vector<T1>())
    116     { plot(y,x,"replot"); }
     124    { return plot(y,x,"replot"); }
    117125
    118126  private:
     
    128136    ///
    129137    template <class T1, class T2>
    130     void plot(const std::vector<T1>& y, const std::vector<T2>& x,
     138    int plot(const std::vector<T1>& y, const std::vector<T2>& x,
    131139              const std::string& plotcmd)
    132140    {
     
    146154      cmdstring << "e\n";
    147155
    148       command(cmdstring.str());
     156      return command(cmdstring.str());
    149157    }
    150158
Note: See TracChangeset for help on using the changeset viewer.