D:/WorkDir/SugoiProjects/SugoiTools/include/SugoiTools/cl_mod.h

00001 /* LICENSE_BEGIN
00002 SutoiTools library supply support for debugging, testing and 
00003 setting good bases for you application. It is part of the 
00004 SugoiEngine project.
00005 Copyright (C) 2006 Allusse Yannick (yannick dot allusse at laposte dot net)
00006 
00007 This program is free software; you can redistribute it and/or
00008 modify it under the terms of the GNU General Public License
00009 as published by the Free Software Foundation; either version 2
00010 of the License, or (at your option) any later version.
00011 
00012 This program is distributed in the hope that it will be useful,
00013 but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 GNU General Public License for more details.
00016 
00017 You should have received a copy of the GNU General Public License
00018 along with this program; if not, write to the Free Software
00019 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00020 LICENSE_END
00021 */
00022 
00023 /* \file SG_TLS_cl_mod.h
00024  * \brief Supply a base class for module and multi-threaded application.
00025  * \author Yannick Allusse
00026  */
00027 
00028 #ifndef _SG_TLS_CL_MOD_H
00029 #define _SG_TLS_CL_MOD_H
00030 
00031 #include "SugoiTools\config.h"
00032 #include "SugoiTools\cl_param.h"
00033 #include "SugoiTools\xml.h"
00034 
00035 namespace SGE{
00036 //pre-definition START==============
00037 class CL_MOD;
00038 //pre-definition END================
00039 
00043 enum MODE_TYPE{
00044           MODTYPE_MOD,
00045           MODTYPE_GLMOD,
00046           MODTYPE_ARMOD, 
00047           MODTYPE_ARMOD_BASE, 
00048           MODTYPE_EDITMOD,
00049           MODTYPE_GAMEMOD,
00050           MODTYPE_MOUSEPICKING,
00051           MODTYPE_ARMOD_271,
00052           MODTYPE_ARMOD_4,
00053           MODTYPE_ARMOD_PLUS
00054 };
00055 //======================================
00056 
00057 #define THREAD_POSIX
00058 
00059 enum ENUM_THREAD_RUNMODE {THREAD_RUN_UNKOWN, THREAD_RUN_ALWAYS, THREAD_RUN_ACTIVE};
00060 
00061 
00066 struct ST_MOD_STATUS
00067 {
00068           bool Activated;                         
00069           int WillActivate;             
00070 
00071 
00072           int WillDesactivate;          
00073 
00074 };
00075 
00076 
00083 class _SG_TLS_EXPORT CL_MOD : 
00084           public CL_XML_BASE_OBJ_FILE
00085 {
00086 public:
00087           CL_PARAM  * Params;           
00088           bool                StartActive;        
00089           bool                StartAsThread;      
00090           std::string DLLName;                    
00091           HINSTANCE DLLInstance;        
00092           std::vector<ST_MOD_STATUS*> VecModStatus;         
00093           ST_MOD_STATUS *ModStatus;     
00094 
00095 protected:
00096           MODE_TYPE Type;
00097 
00098 public:
00102                     CL_MOD (std::string _Name, int _options=0);
00103 
00107                     ~CL_MOD();
00108 
00112                     virtual  bool Init(void);     
00113 
00119                     virtual  void Activate();
00125                     virtual  void Desactivate();
00126 
00127 
00128 #ifdef THREAD_USE
00129           void (*ThreadLoopFc)(void);
00130           void SetThreadLoop(void (*_ThreadLoop)(void));
00131 private:
00132           int ThreadState;
00133           enum ENUM_THREAD_RUNMODE ThreadRunMode;
00134           //int               ThreadStart((LPVOID*)(*_ThreadProc)(void), enum _RunMode/*=THREAD_RUN_ACTIVE*/);
00135           //int               ThreadStart(unsigned int (*LPVOID)_ThreadProc(void), enum _RunMode/*=THREAD_RUN_ACTIVE*/);
00136           void      ThreadPause();
00137           void      ThreadStop();
00138           int                 ThreadGetState();
00139 #endif
00140 
00145                     void PushStatus();
00151                     void PopStatus();
00152 
00153 #if _SG_TLS_XML
00154 
00157           virtual  TiXmlElement* XMLLoad(TiXmlElement* XML_MOD);
00161           virtual  TiXmlElement* XMLSave(TiXmlElement* XML_MOD);
00162 #endif
00163 
00164 
00165 public:
00166           MODE_TYPE GetType();
00167 
00168 //Static functions
00175           static int GetModTypeID(const std::string & _ModType);
00182           static std::string GetModTypeStr(const int _ModType);
00183 //========================
00184 };
00185 
00186 
00187 };//namespace SGE
00188 #endif//_SG_TLS_CL_MOD_H

Generated on Mon Mar 19 23:15:10 2007 for SugoiTools by  doxygen 1.4.6-NO