RegistryAgent.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 REGISTRYAGENT_H
00024 #define REGISTRYAGENT_H
00025 #include "micolelib.h"
00026 
00027 #include <map>
00028 #include <string>
00029 using namespace std;
00030 
00031 #include "MicoleAgent.h"
00032 #include "Entry.h"
00033 
00040 /*
00041 * Registers agents and gives identifiers for them.
00042 */
00043 class MICOLELIB_API RegistryAgent: public MicoleAgent
00044 {
00045         private:
00046                 map<int,Entry> agents;
00047                 map<string, string> _envVars;
00048 
00049         public:
00050                 RegistryAgent(const string &name, const string &domain);
00051                 ~RegistryAgent();
00052 
00053                 void handleRegisterMessage(MicoleBus *app, int argc, const char **argv);
00054                 void handleUnRegisterMessage(MicoleBus *app, int argc, const char **argv);
00055                 void handlePrintRequest(MicoleBus *app, int argc, const char **argv);
00056                 void handleQuitMessage( MicoleBus *app, int argc, const char **argv);
00057                 void handleSetVar(MicoleBus *app, int argc, const char **argv);
00058 
00059                 void handleGetVar(MicoleBus *app, int argc, const char **argv);
00060                 
00061 
00062                 string getVar(string varName) 
00063                 {
00064                         return _envVars[varName];
00065                 }
00066                 
00067                 double getFloatVar(string varName) 
00068                 {
00069                         return atof(_envVars[varName].c_str());
00070                 }
00071                 
00072                 void setVar(string varName, string value)
00073                 {
00074                         _envVars[varName] = value;
00075                 }
00076 };
00077  //core classes
00079 
00080 #endif
00081 

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