00001 /* 00002 * Name: action.hh 00003 * Authors: Francisco Vides Fernandez 00004 * Contributor: Rafael Jesus Alcantara Perez 00005 * Summary: Base for action 00006 * Date: $Date: 2003/04/14 00:18:31 $ 00007 * Revision: $Revision: 1.1 $ 00008 * 00009 * Copyright (C) 1999-2000 Francisco Vides Fernandez <pvides@dedalo-ing.com> 00010 * Copyright (C) 2000-2002 Rafael Jesus Alcantara Perez <rafa@dedalo-ing.com> 00011 * 00012 * This program is free software; you can redistribute it and/or modify 00013 * it under the terms of the GNU General Public License as published by 00014 * the Free Software Foundation; either version 2 of the License, or 00015 * (at your option) any later version. 00016 * 00017 * This program is distributed in the hope that it will be useful, 00018 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 * GNU General Public License for more details. 00021 * 00022 * You should have received a copy of the GNU General Public License 00023 * along with this program; if not, write to the Free Software 00024 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 00025 * MA 02111-1307, USA. 00026 */ 00027 00028 #ifndef _MPCL_EVENT_ACTION__ 00029 #define _MPCL_EVENT_ACTION__ 00030 00031 #include "../text/string.hh" 00032 00033 00035 namespace mpcl 00036 { 00037 00039 namespace event 00040 { 00041 00042 using text::TString; 00043 00045 class IAction 00046 { 00047 00048 private: 00049 00051 TString yName; 00052 00053 00054 public: 00055 00056 // 00057 // C O N S T R U C T O R S 00058 // 00059 00063 IAction (void) : 00064 yName () {} 00065 00070 IAction (const TString& rkyNAME) : 00071 yName (rkyNAME) {} 00072 00074 virtual ~IAction (void) {} 00075 00080 virtual bool execute (void) = 0; 00081 00086 bool operator () (void) 00087 { 00088 return execute(); 00089 } 00090 00095 virtual int react (void) = 0; 00096 00101 void setName (const TString& rkyNAME) 00102 { 00103 yName = rkyNAME; 00104 } 00105 00106 00107 public: 00108 00109 // 00110 // S E L E C T O R S 00111 // 00112 00117 const TString& getName (void) const 00118 { 00119 return yName; 00120 } 00121 00122 }; // class IAction 00123 00124 } // namespace event 00125 00126 } // namespace mpcl 00127 00128 00129 #endif // not _MPCL_EVENT_ACTION__