remote.h

Go to the documentation of this file.
00001 /* Gxsm - Gnome X Scanning Microscopy
00002  * universal STM/AFM/SARLS/SPALEED/... controlling and
00003  * data analysis software
00004  * 
00005  * Copyright (C) 1999,2000,2001,2002,2003 Percy Zahl
00006  *
00007  * Authors: Percy Zahl <zahl@users.sf.net>
00008  * additional features: Andreas Klust <klust@users.sf.net>
00009  * WWW Home: http://gxsm.sf.net
00010  *
00011  * This program is free software; you can redistribute it and/or modify
00012  * it under the terms of the GNU General Public License as published by
00013  * the Free Software Foundation; either version 2 of the License, or
00014  * (at your option) any later version.
00015  *
00016  * This program is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  * GNU General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU General Public License
00022  * along with this program; if not, write to the Free Software
00023  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
00024  */
00025 
00026 /* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 8 c-style: "K&R" -*- */
00027 
00028 #ifndef REMOTE__H
00029 #define REMOTE__H
00030 
00031 
00032 #define REMO_PIPEBROKEN          0
00033 #define REMO_CMD                 1
00034 #define REMO_INVALID_CMD         2
00035 #define REMO_QUIT                3
00036 
00037 #define CMDFKTARGS gchar **arglist, gpointer data
00038 
00039 enum REMOTE_TYP { REMO_ACTION, REMO_MENUACTION, REMO_SETENTRY, REMO_CBACTION, REMO_ENDLIST };
00040 
00041 typedef struct remote_action_cb {
00042     gchar  *cmd;
00043     void (*RemoteCb)(GtkWidget *widget , gpointer data);
00044     GtkWidget *widget;
00045     gpointer data;
00046 };
00047 
00048 typedef struct remote_cmd {
00049   char     *cmd;
00050   int      (*CmdFkt)(CMDFKTARGS);
00051   gpointer data;
00052 };
00053 
00054 typedef struct remote_verb {
00055   REMOTE_TYP typ;
00056   char       *verb;
00057   remote_cmd *cmd_list;
00058 };
00059 
00060 class remote{
00061 public:
00062   remote();
00063   virtual ~remote();
00064 
00065   void rcopen(gchar *crtlfifo, gchar *statfifo=NULL);
00066   void rcclose();
00067 
00068   int writestatus(gchar *mld);
00069   gboolean readfifo(GIOChannel *src);
00070   virtual int eval(char *cmdstr);
00071 
00072   void wait(gint w){ waitflg=w; };
00073   gint waiting(){ return waitflg; };
00074   virtual void waitfkt(){};
00075 protected:
00076   gint remotefifo;
00077   gint statusfifo;
00078 private:
00079   gint waitflg;
00080 };
00081 
00082 class remote_crtl : public remote{
00083 public:
00084   remote_crtl(remote_verb *rvlist);
00085   virtual ~remote_crtl();
00086 
00087   virtual int eval(char *cmdstr);
00088   virtual int addcmd(gchar **cmdargvlist)=0;
00089   virtual int checkentry(gchar **cmdargvlist)=0;
00090   virtual int checkactions(gchar **cmdargvlist)=0;
00091   virtual void waitfkt(){};
00092 
00093   void senderror(char *errstr);
00094   void sendcmd(char *cmd, char *arg, gchar **arglist);
00095   void quit();
00096 
00097   int ExecAction(gchar **arglist);
00098 
00099 protected:
00100 private:
00101   int FindFktExec(char *cmd, char *arg, gchar **arglist);
00102 
00103   remote_verb *rlist;
00104   remote_cmd *rfkt;
00105   char *rarg;
00106 };
00107 
00108 #endif
00109 

Generated on Sat Apr 1 09:04:03 2006 for GXSM by  doxygen 1.4.6