AbstractMicoleApplication.h

Go to the documentation of this file.
00001 /*
00002  * This file is part of Micole Architecture
00003  *
00004  * Copyright (C) 2007 Micole partners
00005  *
00006  * Micole Architecture is free software: you can redistribute it 
00007  * and/or modify it under the terms of the GNU Lesser General 
00008  * Public License as published by the Free Software Foundation, 
00009  * either version 3 of the License, or (at your option) any 
00010  * later version.
00011  *
00012  * Micole Architecture is distributed in the hope that it will be 
00013  * useful, * but WITHOUT ANY WARRANTY; without even the implied 
00014  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00015  * PURPOSE.  See the GNU Lesser General Public License for more 
00016  * details.
00017  *
00018  * You should have received a copy of the GNU Lesser General Public
00019  * License along with Micole Architecture.  If not, see
00020  * <http://www.gnu.org/licenses/>.
00021  */
00022 
00023 #ifndef ABSTRACMICOLEAPPLICATION_H
00024 #define ABSTRACMICOLEAPPLICATION_H
00025 
00026 #include "micolelib.h"
00027 
00028 #include "RegistryAgent.h"
00029 #include "NetworkAgent.h"
00030 
00031 //for retro-compatibility
00032 #define sendIvyMessage sendBusMessage
00033 
00040 class MICOLELIB_API AbstractMicoleApplication
00041 {
00042         public:
00043                 
00047                 virtual ~AbstractMicoleApplication(void);
00048           
00053                 static AbstractMicoleApplication * getInstance()
00054                 {
00055                         if (!_instance)
00056                                 _instance = new AbstractMicoleApplication;
00057                         return _instance;
00058                 }
00059 
00064                 int sendBusMessage(const char * c);
00065 
00071                 void startNetwork(char * host = "127.0.0.1", int port = 33483);
00072 
00077                 void sendNetworkMessage(string s);
00078 
00083                 static string getVar(string varName)
00084                 {
00085                         return AbstractMicoleApplication::getInstance()->_registry->getVar(varName);
00086                 }
00087 
00092                 static void setVar(string varName, string varValue)
00093                 {
00094                         return AbstractMicoleApplication::getInstance()->_registry->setVar(varName,varValue);
00095                 }
00096 
00102                 static double getFloatVar(string varName)
00103                 {
00104                         return AbstractMicoleApplication::getInstance()->_registry->getFloatVar(varName);
00105                 }
00106 
00107         protected:
00112                 AbstractMicoleApplication(void);
00113                 static AbstractMicoleApplication* _instance; 
00115         private:
00116 
00117                 RegistryAgent * _registry;
00118                 NetworkAgent * _networkAgent;
00119 };
00120 
00121 #endif

Generated on Tue Oct 16 17:10:42 2007 for Micole by  doxygen 1.4.7