Permalink
Browse files

A bunch of fixes

  • Loading branch information...
1 parent 8ac9d20 commit 00d77ae1a91eb0b003de720c6669b0b8a639acaa Giovanni [dacav] Simoni committed Oct 15, 2011
Showing with 9 additions and 97 deletions.
  1. +0 −1 src/gnupplus.hpp
  2. +0 −66 src/gnupplus/except.hpp
  3. +0 −2 src/gnupplus/gnuplot.hpp
  4. +2 −11 src/gnupplus/layout.hpp
  5. +7 −16 src/layout.cpp
  6. +0 −1 src/plots.cpp
View
@@ -21,6 +21,5 @@
#include <gnupplus/drawable.hpp>
#include <gnupplus/layout.hpp>
#include <gnupplus/pipe.hpp>
-#include <gnupplus/except.hpp>
#include <gnupplus/gnuplot.hpp>
#include <gnupplus/plots.hpp>
@@ -1,66 +0,0 @@
-/*
- * Copyright 2010 Giovanni Simoni
- *
- * This file is part of libgnupplus.
- *
- * libgnupplus is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * libgnupplus is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with libgnupplus. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef __defined_gnup_except_hpp
-#define __defined_gnup_except_hpp
-
-#include <exception>
-
-namespace gnup {
-
- /** General exception for the gnup library */
- class Error : public std::exception {
- public:
-
- /** Constructor with message
- *
- * @param msg The error message.
- */
- Error (const char *msg) throw ();
-
- /** Copy constructor
- *
- * @param copy The copy.
- */
- Error (Error &copy) throw ();
-
- /** Destructor
- *
- * It's already virtual, since the class inherits from
- * std::exception.
- */
- ~Error () throw ();
-
- /** Cause of the exception
- *
- * @return A string describing the error.
- */
- const char *what () const throw ();
-
- private:
-
- /** The string returned by the gnup::Error::what method. */
- const char *msg;
- };
-
-}
-
-#endif // __defined_gnup_except_hpp
-
@@ -29,7 +29,6 @@
namespace gnup {
class GnuPlot : public Comm, Trigger {
-
public:
GnuPlot (const char * prog = "gnuplot",
const char * args[] = NULL,
@@ -49,7 +48,6 @@ namespace gnup {
Layout *layout;
bool def_layout;
const char *title;
-
};
}
@@ -32,7 +32,6 @@
#include <gnupplus/drawable.hpp>
#include <gnupplus/plots.hpp>
#include <gnupplus/pipe.hpp>
-#include <gnupplus/except.hpp>
namespace gnup {
@@ -50,9 +49,7 @@ namespace gnup {
* characterized by some graph-related characteistics.
*/
class Cell : public Drawable {
-
public:
-
Cell ();
Cell (Cell &c);
@@ -73,10 +70,9 @@ namespace gnup {
void setTrigger (Trigger *t);
private:
-
size_t dimensions;
-
- const char *title;
+ uint8_t flags;
+ std::string title;
struct {
const char *x, *y, *z;
} labels;
@@ -86,7 +82,6 @@ namespace gnup {
} x, y, z;
} ranges;
- uint8_t flags;
static const uint8_t RANGE_X = 1 << 0;
static const uint8_t RANGE_Y = 1 << 1;
static const uint8_t RANGE_Z = 1 << 2;
@@ -99,7 +94,6 @@ namespace gnup {
void init (Comm *c);
void display (Comm *c);
void reset (Comm *c);
-
};
/** From cell coordinate to plot.
@@ -116,7 +110,6 @@ namespace gnup {
};
class Layout : public Drawable {
-
public:
Layout (size_t nrows, size_t ncols);
Layout (Layout &l);
@@ -128,7 +121,6 @@ namespace gnup {
Cell & getCell (unsigned row = 0, unsigned col = 0);
private:
-
void init (Comm *c);
void display (Comm *c);
void reset (Comm *c);
@@ -137,7 +129,6 @@ namespace gnup {
size_t nrows;
CellMap cells;
-
};
}
View
@@ -25,19 +25,15 @@ using std::make_pair;
namespace gnup {
Cell::Cell ()
+ : dimensions(0), flags(0)
{
- flags = 0;
- dimensions = 0;
}
Cell::Cell (Cell &c)
+ : dimensions(c.dimensions), flags(c.flags),
+ title(c.title), labels(c.labels),
+ ranges(c.ranges), plots(c.plots)
{
- flags = c.flags;
- dimensions = c.dimensions;
- title = c.title;
- labels = c.labels;
- ranges = c.ranges;
- plots = c.plots;
}
void Cell::setTitle (const char *t)
@@ -98,7 +94,6 @@ namespace gnup {
if (flags & RANGE_Z) {
c->command(set_range, 'z', ranges.z.min, ranges.z.max);
}
-
if (flags & LABEL_X) {
c->command(set_label, 'x', labels.x);
}
@@ -108,12 +103,9 @@ namespace gnup {
if (flags & LABEL_Z) {
c->command(set_label, 'z', labels.z);
}
-
- if (title != NULL) {
- c->command("set title \"%s\"\n", title);
+ if (title.length() != 0) {
+ c->command("set title \"%s\"\n", title.c_str());
}
-
-
}
void Cell::setTrigger (Trigger *t)
@@ -129,7 +121,7 @@ namespace gnup {
{
size_t size;
typedef std::list<Plot *>::iterator It;
-
+
if ((size = plots.size()) == 0) {
return;
}
@@ -177,7 +169,6 @@ namespace gnup {
typedef CellMap::iterator It;
if (&l != this) {
-
nrows = l.nrows;
ncols = l.ncols;
View
@@ -51,7 +51,6 @@ namespace gnup {
double *v = new double[n];
std::copy(vals, vals + n, v);
-
data.push_back(v);
if (max_size && data.size() > max_size) {
delete[] data.front();

0 comments on commit 00d77ae

Please sign in to comment.