DBServer_MySQL.h

См. документацию.
00001 /* This file is part of the UniSet project
00002  * Copyright (c) 2002 Free Software Foundation, Inc.
00003  * Copyright (c) 2002 Pavel Vainerman
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 Free Software
00017  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00018  */
00019 // --------------------------------------------------------------------------
00023 // -------------------------------------------------------------------------- 
00024 #ifndef DBServer_MySQL_H_
00025 #define DBServer_MySQL_H_
00026 // --------------------------------------------------------------------------
00027 #include <map>
00028 #include "UniSetTypes.h"
00029 #include "DBInterface.h"
00030 #include "DBServer.h"
00031 //------------------------------------------------------------------------------------------
00133 class DBServer_MySQL: 
00134     public DBServer
00135 {
00136     public:
00137         DBServer_MySQL( UniSetTypes::ObjectId id );
00138         DBServer_MySQL();
00139         ~DBServer_MySQL();
00140 
00141     protected:
00142         typedef std::map<int, std::string> DBTableMap;
00143 
00144         virtual void initDB(DBInterface *db){};
00145         virtual void initDBTableMap(DBTableMap& tblMap){};
00146 
00147         virtual void processingMessage( UniSetTypes::VoidMessage *msg );
00148         virtual void timerInfo( UniSetTypes::TimerMessage* tm );
00149         virtual void sysCommand( UniSetTypes::SystemMessage* sm );
00150 
00151         // Функции обработки пришедших сообщений
00152         virtual void parse( UniSetTypes::SensorMessage* sm );
00153         virtual void parse( UniSetTypes::DBMessage* dbmsg );
00154         virtual void parse( UniSetTypes::InfoMessage* imsg );
00155         virtual void parse( UniSetTypes::AlarmMessage* amsg );
00156         virtual void parse( UniSetTypes::ConfirmMessage* cmsg );
00157 
00158         bool writeToBase( const string& query );
00159         virtual void init_dbserver();
00160         void createTables( DBInterface* db );
00161         
00162         inline const char* tblName(int key)
00163         {
00164             return tblMap[key].c_str();
00165         }
00166 
00167         enum Timers
00168         {
00169             PingTimer,      
00170             ReconnectTimer  
00171         };
00172 
00173 
00174         DBInterface *db;
00175         int PingTime;
00176         int ReconnectTime;
00177         bool connect_ok;    
00179         bool activate;
00180 
00181     private:
00182         DBTableMap tblMap;
00183 
00184 };
00185 //------------------------------------------------------------------------------------------
00186 #endif

Документация по UniSet. Последние изменения: Mon Dec 26 11:26:53 2011. Создано системой  doxygen 1.5.9