fdhwlib  2.0.25
/home/kopmann/git-mirror/fdhwlib/fdhwlib/Hw/eventloopclient.h
Go to the documentation of this file.
00001 /***************************************************************************
00002                           eventloopclient.h  -  description
00003                              -------------------
00004     begin                : Fr December 08 2006
00005     copyright            : (C) 2006 by 
00006     email                : 
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
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  ***************************************************************************/
00017 
00018 #ifndef EVENTLOOPCLIENT_H
00019 #define EVENTLOOPCLIENT_H
00020 
00021 #include <fdhwlib.h>
00022 
00023 
00024 #include <cstdio>
00025 #include <string>
00026 
00027 #include <Hw/eventloop.h>
00028 
00029 
00030 #define PAGE_STACK_LEN 100 // Must be larger than the physical available number
00031                            // of pages.
00032 
00033 
00034 class SimpleSocket;
00035 
00036 
00042 class EventLoopClient : public EventLoop {
00043 public:
00045   EventLoopClient(const char *server, unsigned short port);
00046  
00047   ~EventLoopClient();
00048   
00050   void connect();
00051 
00053   void disconnect();
00054 
00059   void run(FILE *fout, int n=0);
00060 
00063   int read_from_keyboard();
00064 
00066   int read_from_client(int filedes);
00067   
00069   void keyboard_cmds(FILE *fout, char *line);
00070   
00072   void help(FILE *fout);
00073 
00075   void sendDatabase();
00076 
00078   int startRun(int n = 0);
00079 
00081   int stopRun();
00082       
00083 protected:
00084 
00086   SimpleSocket *daq;
00087 
00088   std::string daqServer;
00089 
00090   unsigned short daqPort;
00091 
00093   int debug;
00094   
00095 };
00096 
00097 #endif