author | Tom Wambold <tom5760@gmail.com> |
Fri, 21 Aug 2009 16:23:41 -0400 | |
changeset 4776 | 6ef853626f2a |
parent 4061 | 359e0a1b5cf8 |
permissions | -rw-r--r-- |
1879
876026968947
Gnuplot output class for contrib module
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
876026968947
Gnuplot output class for contrib module
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
2 |
/* |
4061
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
3 |
* Copyright (c) 2007 INRIA, 2008 Timo Bingmann |
1879
876026968947
Gnuplot output class for contrib module
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
4 |
* |
876026968947
Gnuplot output class for contrib module
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
876026968947
Gnuplot output class for contrib module
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
876026968947
Gnuplot output class for contrib module
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation; |
876026968947
Gnuplot output class for contrib module
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
8 |
* |
876026968947
Gnuplot output class for contrib module
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
876026968947
Gnuplot output class for contrib module
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
876026968947
Gnuplot output class for contrib module
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
876026968947
Gnuplot output class for contrib module
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
12 |
* GNU General Public License for more details. |
876026968947
Gnuplot output class for contrib module
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
13 |
* |
876026968947
Gnuplot output class for contrib module
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
876026968947
Gnuplot output class for contrib module
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
876026968947
Gnuplot output class for contrib module
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
876026968947
Gnuplot output class for contrib module
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
17 |
* |
4061
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
18 |
* Original Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
19 |
* Enhancements: Timo Bingmann <timo.bingmann@student.kit.edu> |
1879
876026968947
Gnuplot output class for contrib module
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
20 |
*/ |
876026968947
Gnuplot output class for contrib module
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
21 |
#ifndef GNUPLOT_H |
876026968947
Gnuplot output class for contrib module
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
22 |
#define GNUPLOT_H |
876026968947
Gnuplot output class for contrib module
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
23 |
|
876026968947
Gnuplot output class for contrib module
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
24 |
#include <string> |
876026968947
Gnuplot output class for contrib module
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
25 |
#include <vector> |
876026968947
Gnuplot output class for contrib module
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
26 |
#include <utility> |
876026968947
Gnuplot output class for contrib module
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
27 |
|
876026968947
Gnuplot output class for contrib module
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
28 |
namespace ns3 { |
876026968947
Gnuplot output class for contrib module
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
29 |
|
2694
9440242e1c76
some more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2519
diff
changeset
|
30 |
/** |
4061
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
31 |
* \brief Abstract class to store a plot line to be used by ns3::Gnuplot. |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
32 |
* |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
33 |
* This class contains a reference counted data object in m_data. The data |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
34 |
* object contains different structs derived from struct Data by subclasses. |
2694
9440242e1c76
some more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2519
diff
changeset
|
35 |
*/ |
1879
876026968947
Gnuplot output class for contrib module
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
36 |
class GnuplotDataset |
876026968947
Gnuplot output class for contrib module
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
37 |
{ |
876026968947
Gnuplot output class for contrib module
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
38 |
public: |
4061
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
39 |
|
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
40 |
/** |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
41 |
* Reference-counting copy constructor. |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
42 |
*/ |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
43 |
GnuplotDataset (const GnuplotDataset& original); |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
44 |
|
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
45 |
/** |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
46 |
* Reference-counting destructor. |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
47 |
*/ |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
48 |
~GnuplotDataset(); |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
49 |
|
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
50 |
/** |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
51 |
* Reference-counting assignment operator. |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
52 |
*/ |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
53 |
GnuplotDataset& operator= (const GnuplotDataset& original); |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
54 |
|
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
55 |
/** |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
56 |
* \brief Change line title. |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
57 |
* \param title the new title string to use for this dataset. |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
58 |
*/ |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
59 |
void SetTitle (const std::string& title); |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
60 |
|
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
61 |
/** |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
62 |
* \brief Change extra formatting style parameters for newly created objects. |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
63 |
* \param extra extra formatting |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
64 |
*/ |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
65 |
static void SetDefaultExtra (const std::string& extra); |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
66 |
|
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
67 |
/** |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
68 |
* \brief Add extra formatting parameters to this dataset. |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
69 |
* \param extra extra formatting |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
70 |
*/ |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
71 |
void SetExtra (const std::string& extra); |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
72 |
|
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
73 |
protected: |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
74 |
|
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
75 |
/// Friend because it accesses m_data and it's virtual functions directly in |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
76 |
/// GenerateOutput(). |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
77 |
friend class Gnuplot; |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
78 |
|
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
79 |
/** |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
80 |
* \brief Extra gnuplot parameters set on every newly created dataset. |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
81 |
*/ |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
82 |
static std::string m_defaultExtra; |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
83 |
|
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
84 |
/** |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
85 |
* \brief Derived classes subclass this struct and add their own data fields. |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
86 |
*/ |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
87 |
struct Data; |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
88 |
|
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
89 |
/** |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
90 |
* Called by constructors of derived classes. |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
91 |
* \param data the reference counted data object representing this dataset. |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
92 |
*/ |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
93 |
GnuplotDataset (struct Data* data); |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
94 |
|
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
95 |
/** |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
96 |
* Reference counted data object. |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
97 |
*/ |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
98 |
struct Data* m_data; |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
99 |
}; |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
100 |
|
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
101 |
/** |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
102 |
* \brief Class to represent a 2D points plot. Set the line or points style |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
103 |
* using SetStyle() and set points using Add(). |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
104 |
*/ |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
105 |
class Gnuplot2dDataset : public GnuplotDataset |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
106 |
{ |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
107 |
public: |
2694
9440242e1c76
some more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2519
diff
changeset
|
108 |
/** |
9440242e1c76
some more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2519
diff
changeset
|
109 |
* The plotting style to use for this dataset. |
9440242e1c76
some more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2519
diff
changeset
|
110 |
*/ |
1879
876026968947
Gnuplot output class for contrib module
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
111 |
enum Style { |
876026968947
Gnuplot output class for contrib module
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
112 |
LINES, |
876026968947
Gnuplot output class for contrib module
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
113 |
POINTS, |
876026968947
Gnuplot output class for contrib module
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
114 |
LINES_POINTS, |
876026968947
Gnuplot output class for contrib module
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
115 |
DOTS, |
876026968947
Gnuplot output class for contrib module
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
116 |
IMPULSES, |
876026968947
Gnuplot output class for contrib module
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
117 |
STEPS, |
876026968947
Gnuplot output class for contrib module
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
118 |
FSTEPS, |
876026968947
Gnuplot output class for contrib module
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
119 |
HISTEPS, |
876026968947
Gnuplot output class for contrib module
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
120 |
}; |
4061
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
121 |
|
2694
9440242e1c76
some more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2519
diff
changeset
|
122 |
/** |
9440242e1c76
some more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2519
diff
changeset
|
123 |
* Whether errorbars should be used for this dataset. |
9440242e1c76
some more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2519
diff
changeset
|
124 |
*/ |
2180
8cbdda2a5c2d
add support for gnuplot error bars
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1879
diff
changeset
|
125 |
enum ErrorBars { |
8cbdda2a5c2d
add support for gnuplot error bars
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1879
diff
changeset
|
126 |
NONE, |
8cbdda2a5c2d
add support for gnuplot error bars
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1879
diff
changeset
|
127 |
X, |
8cbdda2a5c2d
add support for gnuplot error bars
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1879
diff
changeset
|
128 |
Y, |
8cbdda2a5c2d
add support for gnuplot error bars
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1879
diff
changeset
|
129 |
XY |
8cbdda2a5c2d
add support for gnuplot error bars
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1879
diff
changeset
|
130 |
}; |
1879
876026968947
Gnuplot output class for contrib module
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
131 |
|
2694
9440242e1c76
some more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2519
diff
changeset
|
132 |
/** |
9440242e1c76
some more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2519
diff
changeset
|
133 |
* \param title the title to be associated to this dataset. |
9440242e1c76
some more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2519
diff
changeset
|
134 |
* |
9440242e1c76
some more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2519
diff
changeset
|
135 |
* Create an empty dataset. Usually, the dataset's title is |
9440242e1c76
some more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2519
diff
changeset
|
136 |
* displayed in the legend box. |
9440242e1c76
some more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2519
diff
changeset
|
137 |
*/ |
4061
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
138 |
Gnuplot2dDataset (const std::string& title = "Untitled"); |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
139 |
|
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
140 |
/** |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
141 |
* Change default style for all newly created objects. |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
142 |
* \param style the style of plotting to use for newly created datasets. |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
143 |
*/ |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
144 |
static void SetDefaultStyle (enum Style style); |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
145 |
|
2694
9440242e1c76
some more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2519
diff
changeset
|
146 |
/** |
9440242e1c76
some more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2519
diff
changeset
|
147 |
* \param style the style of plotting to use for this dataset. |
9440242e1c76
some more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2519
diff
changeset
|
148 |
*/ |
1879
876026968947
Gnuplot output class for contrib module
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
149 |
void SetStyle (enum Style style); |
4061
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
150 |
|
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
151 |
/** |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
152 |
* Change default errorbars style for all newly created objects. |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
153 |
* \param errorBars the style of errorbars to use for newly created datasets. |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
154 |
*/ |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
155 |
static void SetDefaultErrorBars (enum ErrorBars errorBars); |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
156 |
|
2694
9440242e1c76
some more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2519
diff
changeset
|
157 |
/** |
9440242e1c76
some more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2519
diff
changeset
|
158 |
* \param errorBars the style of errorbars to display. |
9440242e1c76
some more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2519
diff
changeset
|
159 |
* |
9440242e1c76
some more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2519
diff
changeset
|
160 |
* If you use any style other than none, you need |
9440242e1c76
some more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2519
diff
changeset
|
161 |
* to make sure you store the delta information in |
9440242e1c76
some more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2519
diff
changeset
|
162 |
* this dataset with the right GnuplotDataset::Add |
9440242e1c76
some more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2519
diff
changeset
|
163 |
* method. |
9440242e1c76
some more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2519
diff
changeset
|
164 |
*/ |
2180
8cbdda2a5c2d
add support for gnuplot error bars
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1879
diff
changeset
|
165 |
void SetErrorBars (enum ErrorBars errorBars); |
4061
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
166 |
|
2694
9440242e1c76
some more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2519
diff
changeset
|
167 |
/** |
9440242e1c76
some more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2519
diff
changeset
|
168 |
* \param x x coord to new data point |
9440242e1c76
some more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2519
diff
changeset
|
169 |
* \param y y coord to new data point |
9440242e1c76
some more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2519
diff
changeset
|
170 |
* |
9440242e1c76
some more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2519
diff
changeset
|
171 |
* Use this method with error bar style NONE. |
9440242e1c76
some more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2519
diff
changeset
|
172 |
*/ |
1879
876026968947
Gnuplot output class for contrib module
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
173 |
void Add (double x, double y); |
4061
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
174 |
|
2694
9440242e1c76
some more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2519
diff
changeset
|
175 |
/** |
9440242e1c76
some more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2519
diff
changeset
|
176 |
* \param x x coord to new data point |
9440242e1c76
some more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2519
diff
changeset
|
177 |
* \param y y coord to new data point |
4061
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
178 |
* \param errorDelta data point error range. |
2694
9440242e1c76
some more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2519
diff
changeset
|
179 |
* |
9440242e1c76
some more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2519
diff
changeset
|
180 |
* Use this method with error bar style X or Y. |
9440242e1c76
some more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2519
diff
changeset
|
181 |
*/ |
2180
8cbdda2a5c2d
add support for gnuplot error bars
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1879
diff
changeset
|
182 |
void Add (double x, double y, double errorDelta); |
4061
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
183 |
|
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
184 |
/** |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
185 |
* \param x x coord to new data point |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
186 |
* \param y y coord to new data point |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
187 |
* \param minY minimum error data point |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
188 |
* \param maxY maximum error data point |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
189 |
* |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
190 |
* Use this method with error bar style X or Y. |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
191 |
*/ |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
192 |
void Add (double x, double y, double minY, double maxY); |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
193 |
|
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
194 |
/** |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
195 |
* Add an empty line in the data output sequence. Empty lines in the plot |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
196 |
* data break continuous lines and do other things in the output. |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
197 |
*/ |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
198 |
void AddEmptyLine(); |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
199 |
|
1879
876026968947
Gnuplot output class for contrib module
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
200 |
private: |
4061
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
201 |
|
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
202 |
struct Point { |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
203 |
bool empty; |
2180
8cbdda2a5c2d
add support for gnuplot error bars
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1879
diff
changeset
|
204 |
double x; |
8cbdda2a5c2d
add support for gnuplot error bars
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1879
diff
changeset
|
205 |
double y; |
8cbdda2a5c2d
add support for gnuplot error bars
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1879
diff
changeset
|
206 |
double dx; |
8cbdda2a5c2d
add support for gnuplot error bars
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1879
diff
changeset
|
207 |
double dy; |
8cbdda2a5c2d
add support for gnuplot error bars
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1879
diff
changeset
|
208 |
}; |
4061
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
209 |
|
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
210 |
typedef std::vector<struct Point> PointSet; |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
211 |
|
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
212 |
static enum Style m_defaultStyle; |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
213 |
static enum ErrorBars m_defaultErrorBars; |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
214 |
|
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
215 |
/// Forward declaration of the internal data class. |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
216 |
struct Data2d; |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
217 |
}; |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
218 |
|
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
219 |
/** |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
220 |
* \brief Class to represent a 2D function expression plot. |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
221 |
* |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
222 |
* Since the function expression is not escaped, styles and extras could just |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
223 |
* as well be included in the expression string. |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
224 |
*/ |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
225 |
class Gnuplot2dFunction : public GnuplotDataset |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
226 |
{ |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
227 |
public: |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
228 |
/** |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
229 |
* \param title the title to be associated to this dataset. |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
230 |
* \param function function to plot |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
231 |
* |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
232 |
* Create an function dataset. Usually, the dataset's title is displayed in |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
233 |
* the legend box. |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
234 |
*/ |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
235 |
Gnuplot2dFunction (const std::string& title = "Untitled", const std::string& function = ""); |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
236 |
|
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
237 |
/** |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
238 |
* \param function new function string to set |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
239 |
*/ |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
240 |
void SetFunction (const std::string& function); |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
241 |
|
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
242 |
private: |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
243 |
|
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
244 |
/// Forward declaration of the internal data class. |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
245 |
struct Function2d; |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
246 |
}; |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
247 |
|
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
248 |
/** |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
249 |
* \brief Class to represent a 3D points plot. Set the line or points style |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
250 |
* using SetStyle() and set points using Add(). |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
251 |
*/ |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
252 |
class Gnuplot3dDataset : public GnuplotDataset |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
253 |
{ |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
254 |
public: |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
255 |
/** |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
256 |
* \param title the title to be associated to this dataset. |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
257 |
* |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
258 |
* Create an empty dataset. Usually, the dataset's title is |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
259 |
* displayed in the legend box. |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
260 |
*/ |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
261 |
Gnuplot3dDataset (const std::string& title = "Untitled"); |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
262 |
|
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
263 |
/** |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
264 |
* Change default style for all newly created objects. |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
265 |
* \param style the style of plotting to use for newly created datasets. |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
266 |
*/ |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
267 |
static void SetDefaultStyle (const std::string& style); |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
268 |
|
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
269 |
/** |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
270 |
* \param style the style of plotting to use for this dataset. |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
271 |
*/ |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
272 |
void SetStyle (const std::string& style); |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
273 |
|
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
274 |
/** |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
275 |
* \param x x coord to new data point |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
276 |
* \param y y coord to new data point |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
277 |
* \param z z coord to new data point |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
278 |
* |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
279 |
* Use this method to add a new 3D point |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
280 |
*/ |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
281 |
void Add (double x, double y, double z); |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
282 |
|
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
283 |
/** |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
284 |
* Add an empty line in the data output sequence. Empty lines in the plot |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
285 |
* data break continuous lines and do other things in the output. |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
286 |
*/ |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
287 |
void AddEmptyLine(); |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
288 |
|
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
289 |
private: |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
290 |
|
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
291 |
struct Point { |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
292 |
bool empty; |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
293 |
double x, y, z; |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
294 |
}; |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
295 |
|
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
296 |
typedef std::vector<struct Point> PointSet; |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
297 |
|
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
298 |
static std::string m_defaultStyle; |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
299 |
|
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
300 |
/// Forward declaration of the internal data class. |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
301 |
struct Data3d; |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
302 |
}; |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
303 |
|
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
304 |
/** |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
305 |
* \brief Class to represent a 3D function expression plot. |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
306 |
* |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
307 |
* Since the function expression is not escaped, styles and extras could just as |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
308 |
* well be included in the expression string. The only difference to |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
309 |
* Gnuplot2dFunction is the splot command string. |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
310 |
*/ |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
311 |
class Gnuplot3dFunction : public GnuplotDataset |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
312 |
{ |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
313 |
public: |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
314 |
/** |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
315 |
* \param title the title to be associated to this dataset. |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
316 |
* \param function function to plot |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
317 |
* |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
318 |
* Create an function dataset. Usually, the dataset's title is displayed in |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
319 |
* the legend box. |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
320 |
*/ |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
321 |
Gnuplot3dFunction (const std::string& title = "Untitled", const std::string& function = ""); |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
322 |
|
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
323 |
/** |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
324 |
* \param function new function string to set |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
325 |
*/ |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
326 |
void SetFunction (const std::string& function); |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
327 |
|
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
328 |
private: |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
329 |
|
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
330 |
/// Forward declaration of the internal data class. |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
331 |
struct Function3d; |
1879
876026968947
Gnuplot output class for contrib module
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
332 |
}; |
876026968947
Gnuplot output class for contrib module
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
333 |
|
2694
9440242e1c76
some more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2519
diff
changeset
|
334 |
/** |
9440242e1c76
some more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2519
diff
changeset
|
335 |
* \brief a simple class to generate gnuplot-ready plotting commands |
9440242e1c76
some more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2519
diff
changeset
|
336 |
* from a set of datasets. |
9440242e1c76
some more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2519
diff
changeset
|
337 |
* |
9440242e1c76
some more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2519
diff
changeset
|
338 |
* This class really represents a single graph on which multiple datasets |
9440242e1c76
some more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2519
diff
changeset
|
339 |
* can be plotted. |
9440242e1c76
some more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2519
diff
changeset
|
340 |
*/ |
1879
876026968947
Gnuplot output class for contrib module
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
341 |
class Gnuplot |
876026968947
Gnuplot output class for contrib module
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
342 |
{ |
876026968947
Gnuplot output class for contrib module
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
343 |
public: |
2694
9440242e1c76
some more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2519
diff
changeset
|
344 |
/** |
4061
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
345 |
* \param outputFilename the name of the file where the rendering of the |
2694
9440242e1c76
some more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2519
diff
changeset
|
346 |
* graph will be generated if you feed the command stream output by |
9440242e1c76
some more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2519
diff
changeset
|
347 |
* Gnuplot::GenerateOutput to the gnuplot program. |
4061
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
348 |
* \param title title line of the plot page |
2694
9440242e1c76
some more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2519
diff
changeset
|
349 |
*/ |
4061
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
350 |
Gnuplot (const std::string& outputFilename="", const std::string& title = ""); |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
351 |
|
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
352 |
/** |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
353 |
* Crude attempt to auto-detect the correct terminal setting by inspecting |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
354 |
* the filename's extension. |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
355 |
* \param filename output file name |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
356 |
*/ |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
357 |
static std::string DetectTerminal(const std::string& filename); |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
358 |
|
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
359 |
/** |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
360 |
* \param terminal terminal setting string for output. The default terminal |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
361 |
* string is "png" |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
362 |
*/ |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
363 |
void SetTerminal (const std::string& terminal); |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
364 |
|
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
365 |
/** |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
366 |
* \param title set new plot title string to use for this plot. |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
367 |
*/ |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
368 |
void SetTitle (const std::string& title); |
1879
876026968947
Gnuplot output class for contrib module
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
369 |
|
2694
9440242e1c76
some more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2519
diff
changeset
|
370 |
/** |
9440242e1c76
some more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2519
diff
changeset
|
371 |
* \param xLegend the legend for the x horizontal axis |
9440242e1c76
some more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2519
diff
changeset
|
372 |
* \param yLegend the legend for the y vertical axis |
9440242e1c76
some more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2519
diff
changeset
|
373 |
*/ |
4061
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
374 |
void SetLegend (const std::string& xLegend, const std::string& yLegend); |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
375 |
|
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
376 |
/** |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
377 |
* \param extra set extra gnuplot directive for output. |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
378 |
*/ |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
379 |
void SetExtra (const std::string& extra); |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
380 |
|
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
381 |
/** |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
382 |
* \param extra append extra gnuplot directive for output. |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
383 |
*/ |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
384 |
void AppendExtra (const std::string& extra); |
2184
db9f25b01d5c
add legend support to gnuplot output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2180
diff
changeset
|
385 |
|
2694
9440242e1c76
some more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2519
diff
changeset
|
386 |
/** |
9440242e1c76
some more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2519
diff
changeset
|
387 |
* \param dataset add a dataset to the graph to be plotted. |
9440242e1c76
some more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2519
diff
changeset
|
388 |
*/ |
4061
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
389 |
void AddDataset (const GnuplotDataset& dataset); |
1879
876026968947
Gnuplot output class for contrib module
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
390 |
|
2694
9440242e1c76
some more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2519
diff
changeset
|
391 |
/** |
4061
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
392 |
* \param os the output stream on which the relevant gnuplot commands should |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
393 |
* be generated. Including output file and terminal headers. |
2694
9440242e1c76
some more doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2519
diff
changeset
|
394 |
*/ |
4061
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
395 |
void GenerateOutput (std::ostream &os) const; |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
396 |
|
1879
876026968947
Gnuplot output class for contrib module
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
397 |
private: |
4061
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
398 |
typedef std::vector<GnuplotDataset> Datasets; |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
399 |
|
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
400 |
std::string m_outputFilename; |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
401 |
std::string m_terminal; |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
402 |
|
1879
876026968947
Gnuplot output class for contrib module
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
403 |
Datasets m_datasets; |
4061
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
404 |
|
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
405 |
std::string m_title; |
2184
db9f25b01d5c
add legend support to gnuplot output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2180
diff
changeset
|
406 |
std::string m_xLegend; |
db9f25b01d5c
add legend support to gnuplot output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2180
diff
changeset
|
407 |
std::string m_yLegend; |
4061
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
408 |
std::string m_extra; |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
409 |
}; |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
410 |
|
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
411 |
/** |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
412 |
* \brief a simple class to group together multiple gnuplots into one file, |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
413 |
* e.g. for PDF multi-page output terminals. |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
414 |
*/ |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
415 |
class GnuplotCollection |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
416 |
{ |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
417 |
public: |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
418 |
/** |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
419 |
* \param outputFilename the name of the file where the rendering of the |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
420 |
* graph will be generated if you feed the command stream output by |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
421 |
* GnuplotCollection::GenerateOutput to the gnuplot program. |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
422 |
*/ |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
423 |
GnuplotCollection (const std::string& outputFilename); |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
424 |
|
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
425 |
/** |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
426 |
* \param terminal terminal setting string for output. The default terminal |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
427 |
* string is guessed from the output filename's extension. |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
428 |
*/ |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
429 |
void SetTerminal (const std::string& terminal); |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
430 |
|
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
431 |
/** |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
432 |
* \param plot add a plot to the collection to be plotted. |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
433 |
*/ |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
434 |
void AddPlot (const Gnuplot& plot); |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
435 |
|
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
436 |
/** |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
437 |
* Return a pointer to one of the added plots. |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
438 |
* \param id index of plot to return |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
439 |
* \return reference to plot, throws std::range_error if it does not exist. |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
440 |
*/ |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
441 |
Gnuplot& GetPlot(unsigned int id); |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
442 |
|
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
443 |
/** |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
444 |
* \param os the output stream on which the relevant gnuplot commands should |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
445 |
* be generated. |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
446 |
*/ |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
447 |
void GenerateOutput (std::ostream &os) const; |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
448 |
|
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
449 |
private: |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
450 |
typedef std::vector<Gnuplot> Plots; |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
451 |
|
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
452 |
std::string m_outputFilename; |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
453 |
std::string m_terminal; |
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
454 |
|
359e0a1b5cf8
extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3386
diff
changeset
|
455 |
Plots m_plots; |
1879
876026968947
Gnuplot output class for contrib module
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
456 |
}; |
876026968947
Gnuplot output class for contrib module
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
457 |
|
876026968947
Gnuplot output class for contrib module
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
458 |
} // namespace ns3 |
876026968947
Gnuplot output class for contrib module
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
459 |
|
876026968947
Gnuplot output class for contrib module
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
460 |
#endif /* GNUPLOT_H */ |