conexus logo

server.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2001 by Rick L. Vinyard, Jr.                            *
00003  *   rvinyard@cs.nmsu.edu                                                  *
00004  *                                                                         *
00005  *   This file is part of the conexus library.                             *
00006  *                                                                         *
00007  *   The conexus library is free software; you can redistribute it and/or  *
00008  *   modify it under the terms of the GNU General Public License           *
00009  *   version 3 as published by the Free Software Foundation.               *
00010  *                                                                         *
00011  *   The conexus library is distributed in the hope that it will be        *
00012  *   useful, but WITHOUT ANY WARRANTY; without even the implied warranty   *
00013  *   of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU   *
00014  *   General Public License for more details.                              *
00015  *                                                                         *
00016  *   You should have received a copy of the GNU General Public License     *
00017  *   along with this software. If not see <http://www.gnu.org/licenses/>.  *
00018  ***************************************************************************/
00019 #ifndef CONEXUSSERVER_H
00020 #define CONEXUSSERVER_H
00021 
00022 #include <set>
00023 #include <queue>
00024 
00025 #include <sys/select.h>
00026 
00027 #include <sigc++/sigc++.h>
00028 
00029 #include <glibmm/dispatcher.h>
00030 #include <glibmm/thread.h>
00031 
00032 #include <conexus/enums.h>
00033 #include <conexus/data.h>
00034 #include <conexus/object.h>
00035 
00036 namespace Conexus
00037 {
00038 
00043   class Server: public Object
00044   {
00045     protected:
00046 
00047       Server();
00048 
00049     public:
00050 
00051       typedef ConexusPointer<Server> pointer;
00052 
00053       virtual ~Server();
00054 
00055       virtual void start();
00056       virtual void start( bool use_dispatcher );
00057       virtual void stop();
00058 
00070       virtual void set_responsiveness( long r );
00071 
00075       virtual long responsiveness();
00076 
00077       virtual bool is_running();
00078 
00079       sigc::signal<void,StartStop> signal_start_stop();
00080 
00081     protected:
00082       Glib::Thread* m_thread;
00083       bool m_terminate;
00084       bool m_running;
00085       Glib::Dispatcher* m_dispatcher;
00086       bool m_use_dispatcher;
00087       struct timeval m_timeval;
00088       sigc::signal<void,StartStop> m_signal_start_stop;
00089 
00090       virtual void service_thread_main() = 0;
00091 
00092       virtual void pre_start() { }
00093 
00094       virtual void post_start() { }
00095 
00096       virtual void pre_stop() { }
00097 
00098       virtual void post_stop() { }
00099 
00100       virtual void emit() = 0;
00101 
00102     private:
00103       void service_thread_main_proxy();
00104 
00105       void emit_proxy();
00106 
00107   };
00108 
00109 }
00110 
00111 #endif

Generated on Wed Jul 8 15:50:08 2009 for conexus by doxygen 1.5.8