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

fsm.hpp

00001 /*****************************************************************************
00002  * fsm.hpp
00003  *****************************************************************************
00004  * Copyright (C) 2003 the VideoLAN team
00005  * $Id: fsm.hpp 12053 2005-08-06 23:38:31Z asmax $
00006  *
00007  * Authors: Cyril Deguet     <[email protected]>
00008  *          Olivier Teulière <[email protected]>
00009  *
00010  * This program is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2 of the License, or
00013  * (at your option) any later version.
00014  *
00015  * This program is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  * GNU General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU General Public License
00021  * along with this program; if not, write to the Free Software
00022  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
00023  *****************************************************************************/
00024 
00025 #ifndef FSM_HPP
00026 #define FSM_HPP
00027 
00028 #include "../src/skin_common.hpp"
00029 #include <string>
00030 #include <map>
00031 #include <set>
00032 
00033 class EvtGeneric;
00034 class CmdGeneric;
00035 
00036 
00038 class FSM: public SkinObject
00039 {
00040     public:
00041         FSM( intf_thread_t *pIntf ): SkinObject( pIntf ) {}
00042         virtual ~FSM() {}
00043 
00045         void addState( const string &state );
00046 
00048         void addTransition( const string &state1, const string &event,
00049                             const string &state2,
00050                             CmdGeneric *pCmd = NULL );
00051 
00053         const string &getState() const { return m_currentState; }
00054 
00056         void setState( const string &state );
00057 
00060         void handleTransition( const string &event );
00061 
00062     private:
00065         typedef pair<string, string> Key_t;
00066 
00069         typedef pair<string, CmdGeneric*> Data_t;
00070 
00072         string m_currentState;
00073 
00075         set<string> m_states;
00076 
00080         map<Key_t, Data_t> m_transitions;
00081 };
00082 
00083 
00084 #endif

Generated on Tue Dec 20 10:14:43 2005 for vlc-0.8.4a by  doxygen 1.4.2