AbstractMicoleApplication.cpp

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 #include "stdafx.h"
00024 #include "AbstractMicoleApplication.h"
00025 
00026 
00027 AbstractMicoleApplication * AbstractMicoleApplication::_instance = NULL;
00028 
00029 
00030 AbstractMicoleApplication::AbstractMicoleApplication()
00031 :_registry(new RegistryAgent ("RegistryAgent","127.255.255.255:2010"))
00032 {
00033         
00034 }
00035 
00036 AbstractMicoleApplication::~AbstractMicoleApplication()
00037 {
00039         delete(_registry);
00040         delete(_networkAgent);
00041 }
00042 
00043 int AbstractMicoleApplication::sendBusMessage(const char * pStr) 
00044 {
00045         return _registry->sendMessage(pStr);
00046 }
00047 
00048 void AbstractMicoleApplication::startNetwork(char * hostname, int port) {
00049         _networkAgent = new NetworkAgent(hostname, port);
00050 }
00051 
00052 void AbstractMicoleApplication::sendNetworkMessage(string s) {
00053         if (_networkAgent == NULL) {
00054                 throw "unknown network";
00055                 return;
00056         }
00057 
00058         _networkAgent->sendOnNetwork(s);
00059 }

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