Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Examples

Gnuplot Class Template Reference
[Base classes]

#include <gnuplot.h>

Inherited by PlotLog.

Inheritance diagram for Gnuplot:

Inheritance graph
[legend]
List of all members.

Detailed Description

template<class T>
class Gnuplot< T >

Open a Gnuplot window and always show last n values of arbitrary defined channels. T can be std::string or int or anything else supports the << of streams. (It is used as name for a channel.)
Examples:

example.cpp.

Definition at line 37 of file gnuplot.h.

Public Types

typedef std::list< T > nameslist
typedef T channel_name_type

Public Member Functions

 Gnuplot (int buffersize=256)
 ~Gnuplot ()
void command (const std::string &cmd)
void addChannel (const T &name, const std::string &title="", const std::string &style="lines")
void putData (const T &channel, double data)
const nameslistgetNames ()
std::string getTitle (const T &channel)
void show (const T &channel, bool on=true)
void hide (const T &channel)
void show_all (bool on=true)
void hide_all ()
void setTitle (const T &channel, const std::string &title)
void setStyle (const T &channel, const std::string &style)
void plot (int start, int end)
void plot ()
void setStart (int n)
void setEnd (int n)
int getBuffersize ()
void plotXY (const T *x, const T *y, int size)
void plotXY (const T &x, const T &y)
void printToFile (const std::string name="", const std::string ext=".log")

Protected Types

typedef std::map< T, Dataset * > dataset_map

Protected Attributes

FILE * pipe
dataset_map datasets
nameslist namesets
int buffersize
int start
int end


Member Typedef Documentation

typedef T channel_name_type
 

which data type is our template Definition at line 65 of file gnuplot.h.

typedef std::map<T, Dataset*> dataset_map [protected]
 

data type of container storing channel->data relation Definition at line 110 of file gnuplot.h.

typedef std::list<T> nameslist
 

Definition at line 63 of file gnuplot.h.


Constructor & Destructor Documentation

Gnuplot int  buffersize = 256  )  [inline]
 

Definition at line 118 of file gnuplot.h.

~Gnuplot  )  [inline]
 

Definition at line 121 of file gnuplot.h.


Member Function Documentation

void addChannel const T &  name,
const std::string &  title = "",
const std::string &  style = "lines"
[inline]
 

add new channel with name. currently uses name as title if not given.

Reimplemented in PlotLog.

Definition at line 135 of file gnuplot.h.

void command const std::string &  cmd  )  [inline]
 

send arbitrary command to gnuplot. like "set zeroaxis" or other stuff Definition at line 129 of file gnuplot.h.

int getBuffersize  )  [inline]
 

returns buffersize Definition at line 246 of file gnuplot.h.

const nameslist& getNames  )  [inline]
 

returns channel names Definition at line 155 of file gnuplot.h.

std::string getTitle const T &  channel  )  [inline]
 

get title Definition at line 160 of file gnuplot.h.

void hide const T &  channel  )  [inline]
 

switch showing of this channel off Definition at line 175 of file gnuplot.h.

void hide_all  )  [inline]
 

switch showing all channels off Definition at line 186 of file gnuplot.h.

void plot  )  [inline]
 

make gnuplot plot content of data buffers Definition at line 232 of file gnuplot.h.

void plot int  start,
int  end
[inline]
 

make gnuplot plot selected content of data buffers Definition at line 205 of file gnuplot.h.

void plotXY const T &  x,
const T &  y
[inline]
 

make gnuplot XY plot content of x against y data buffers Definition at line 288 of file gnuplot.h.

void plotXY const T *  x,
const T *  y,
int  size
[inline]
 

make gnuplot XY plot content of x against y data buffers use it as follow:

	T x[]={a,b,c};
	T y[]={x,y,z};
	plotXY(x,y,3);
	
Definition at line 256 of file gnuplot.h.

void printToFile const std::string  name = "",
const std::string  ext = ".log"
[inline]
 

save content of all data buffers in files ( file names are: name + channel_name + ext ) Definition at line 294 of file gnuplot.h.

void putData const T &  channel,
double  data
[inline]
 

add new data value to buffer for channel. if channel not exists nothing happens. So you can select channels in your program by commenting out the addChannel() call

Reimplemented in PlotLog.

Definition at line 148 of file gnuplot.h.

void setEnd int  n  )  [inline]
 

set end of plot area

Parameters:
n steps in history (must be larger than start)
Definition at line 243 of file gnuplot.h.

void setStart int  n  )  [inline]
 

set start of plot area

Parameters:
n steps in history (must be smaller than end)
Definition at line 238 of file gnuplot.h.

void setStyle const T &  channel,
const std::string &  style
[inline]
 

set style Definition at line 198 of file gnuplot.h.

void setTitle const T &  channel,
const std::string &  title
[inline]
 

set title Definition at line 191 of file gnuplot.h.

void show const T &  channel,
bool  on = true
[inline]
 

switch showing of this channel on or off Definition at line 168 of file gnuplot.h.

void show_all bool  on = true  )  [inline]
 

switch showing all channels on or off Definition at line 180 of file gnuplot.h.


Member Data Documentation

int buffersize [protected]
 

Definition at line 113 of file gnuplot.h.

dataset_map datasets [protected]
 

Definition at line 111 of file gnuplot.h.

int end [protected]
 

Definition at line 115 of file gnuplot.h.

nameslist namesets [protected]
 

Definition at line 112 of file gnuplot.h.

FILE* pipe [protected]
 

Definition at line 108 of file gnuplot.h.

int start [protected]
 

Definition at line 114 of file gnuplot.h.


The documentation for this class was generated from the following file:
Generated on Wed Apr 6 10:22:31 2005 for Gnuplot by doxygen 1.3.8