Fawkes API
Fawkes Development Version
|
00001 00002 /*************************************************************************** 00003 * network.cpp - Fawkes NetworkAspect initializer/finalizer 00004 * 00005 * Created: Tue Nov 23 23:47:59 2010 00006 * Copyright 2006-2010 Tim Niemueller [www.niemueller.de] 00007 * 00008 ****************************************************************************/ 00009 00010 /* This program is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. A runtime exception applies to 00014 * this software (see LICENSE.GPL_WRE file mentioned below for details). 00015 * 00016 * This program is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU Library General Public License for more details. 00020 * 00021 * Read the full text in the LICENSE.GPL_WRE file in the doc directory. 00022 */ 00023 00024 #include <aspect/inifins/network.h> 00025 #include <aspect/network.h> 00026 #include <netcomm/service_discovery/service_publisher.h> 00027 #include <netcomm/service_discovery/service_browser.h> 00028 #include <netcomm/utils/resolver.h> 00029 00030 namespace fawkes { 00031 #if 0 /* just to make Emacs auto-indent happy */ 00032 } 00033 #endif 00034 00035 /** @class NetworkAspectIniFin <aspect/inifins/network.h> 00036 * Initializer/finalizer for the NetworkAspect. 00037 * @author Tim Niemueller 00038 */ 00039 00040 /** Constructor. 00041 * @param nnresolver network name resolver to pass to threads 00042 * @param service_browser service browser to pass to threads 00043 * @param service_publisher service publisher resolver to pass to threads 00044 */ 00045 NetworkAspectIniFin::NetworkAspectIniFin(NetworkNameResolver *nnresolver, 00046 ServicePublisher *service_publisher, 00047 ServiceBrowser *service_browser) 00048 : AspectIniFin("NetworkAspect") 00049 { 00050 __nnresolver = nnresolver; 00051 __service_publisher = service_publisher; 00052 __service_browser = service_browser; 00053 } 00054 00055 00056 void 00057 NetworkAspectIniFin::init(Thread *thread) 00058 { 00059 NetworkAspect *network_thread; 00060 network_thread = dynamic_cast<NetworkAspect *>(thread); 00061 if (network_thread == NULL) { 00062 throw CannotInitializeThreadException("Thread '%s' claims to have the " 00063 "NetworkAspect, but RTTI says it " 00064 "has not. ", thread->name()); 00065 } 00066 00067 network_thread->init_NetworkAspect(__nnresolver, 00068 __service_publisher, __service_browser); 00069 } 00070 00071 00072 void 00073 NetworkAspectIniFin::finalize(Thread *thread) 00074 { 00075 } 00076 00077 00078 } // end namespace fawkes