Project stdui: "Simple Type Dialog User-Interface"

|
Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

ccontrol.hxx

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2005 by Serge Lussier   *
00003  *   serge.lussier@videotron.ca   *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 
00021 
00022 #ifndef controlccontrol_hxx
00023 #define controlccontrol_hxx
00024 
00025 #include <cmutex.hxx>
00026 #include <cthread.hxx>
00027 //#include <sigc++/sigc++.h>
00028 
00029 namespace control {
00030 
00031 
00032 
00033 const int terminate = 0;
00034 const int proceed   = 1;
00035 const int pause     = 2;
00036 
00042 class ccontrol : public cmutex, public cthread{
00043 public:
00044    typedef sigc::slot<bool> worker_delegate;
00045    ccontrol();
00046    ccontrol(const std::string& nameid, const control::ccontrol::worker_delegate& worker );
00047 
00048    virtual ~ccontrol();
00049 
00050    int wait();
00051    void signal();
00052 
00056    void connect( const sigc::slot<bool>& _work ) { proceed_.connect(_work); }
00057     virtual bool start();
00058     virtual bool init();
00059 
00063     int state() { return _state; }
00064     void terminate();
00065     void release();
00066     bool noop() { return true; }
00067 
00068 private:
00069     bool _cond;
00070     pthread_cond_t* _cv;
00071     sigc::signal<bool> proceed_;
00072     protected:
00073     virtual bool controller_loop();
00074     int _state;
00075 };
00076 
00077 }; // namespace control
00078 
00079 
00080 
00081 #endif

API Documentation Generated by:  doxygen 1.4.0
About the author | Site started with trial version of DreamWeaver MX 2004 | Finalizing with  | Contact | ©2005, Serge Lussier ( Bretzel )