Gnuplot Class Template Reference
[Base classes]

#include <gnuplot.h>

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.)

Definition at line 40 of file gnuplot.h.

Public Types

typedef std::list< Tnameslist
typedef T channel_name_type
 which data type is our template

Public Member Functions

 Gnuplot (int buffersize=256)
 ~Gnuplot ()
void command (const std::string &cmd)
 send arbitrary command to gnuplot.
void addChannel (const T &name, const std::string &title="", const std::string &style="lines")
 add new channel with name.
void putData (const T &channel, double data)
 add new data value to buffer for channel.
const nameslistgetNames ()
 returns channel names
std::string getTitle (const T &channel)
 get title
void show (const T &channel, bool on=true)
 switch showing of this channel on or off
void hide (const T &channel)
 switch showing of this channel off
void show_all (bool on=true)
 switch showing all channels on or off
void hide_all ()
 switch showing all channels off
void setTitle (const T &channel, const std::string &title)
 set title
void setStyle (const T &channel, const std::string &style)
 set style
void plot (int start, int end)
 make gnuplot plot selected content of data buffers
void plot ()
 make gnuplot plot content of data buffers
void setStart (int n)
 set start of plot area
void setEnd (int n)
 set end of plot area
int getBuffersize ()
 returns buffersize
void plotXY (const T *x, const T *y, int size)
 make gnuplot XY plot content of x against y data buffers use it as follow:
void plotXY (const T &x, const T &y)
 make gnuplot XY plot content of x against y data buffers
void printToFile (const std::string name="", const std::string ext=".log")
 save content of all data buffers in files ( file names are: name + channel_name + ext )

Protected Types

typedef std::map< T, Dataset * > dataset_map
 data type of container storing channel->data relation

Protected Attributes

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

Classes

class  Dataset
 data buffer for one channel, organized as ring buffer More...


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, and PlotLog< std::string >.

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, and PlotLog< std::string >.

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.


Generated on Tue Apr 4 19:05:05 2006 for Robotsystem from Robot Group Leipzig by  doxygen 1.4.5