Fawkes API  Fawkes Development Version
fawkes_network.cpp
00001 
00002 /***************************************************************************
00003  *  fawkes_network.cpp - Fawkes network aspect for Fawkes
00004  *
00005  *  Created: Mon May 07 19:45:32 2007
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/fawkes_network.h>
00025 
00026 #include <netcomm/fawkes/hub.h>
00027 
00028 namespace fawkes {
00029 #if 0 /* just to make Emacs auto-indent happy */
00030 }
00031 #endif
00032 
00033 /** @class FawkesNetworkAspect <aspect/fawkes_network.h>
00034  * Thread aspect to participate in the Fawkes Network protocol.
00035  * Give this aspect to your thread to make use of the Fawkes network
00036  * protocol. The protocol is designed to transport short messages over
00037  * the network (information and control data).
00038  * With this aspect you can easily inject messages into the stream and
00039  * and receive messages from connected clients. The component ID has to
00040  * be unique. To ensure this have a look at netcomm/fawkes/component_ids.h.
00041  *
00042  * It is guaranteed that if used properly from within plugins that
00043  * initFawkesNetworkAspect() is called before the thread is started and that
00044  * you can access the Fawkes network hub via the fnethub member.
00045  *
00046  * In most cases you should implement Thread::init() to register
00047  * your FawkesNetworkHandler.
00048  *
00049  * @ingroup Aspects
00050  * @author Tim Niemueller
00051  */
00052 
00053 
00054 /** @var FawkesNetworkHub FawkesNetworkAspect::fnethub
00055  * This is the Fawkes network hub member used to access the Fawkes
00056  * network protocol.
00057  * The logger will remain valid for the whole lifetime of the
00058  * thread.
00059  */
00060 
00061 /** Constructor. */
00062 FawkesNetworkAspect::FawkesNetworkAspect()
00063 {
00064   add_aspect("FawkesNetworkAspect");
00065 }
00066 
00067 /** Virtual empty Destructor. */
00068 FawkesNetworkAspect::~FawkesNetworkAspect()
00069 {
00070 }
00071 
00072 
00073 /** Set the logger.
00074  * It is guaranteed that this is called for a thread having the
00075  * Fawkes netwok aspect before Thread::start() is called (when
00076  * running regularly inside Fawkes).
00077  * @param fnethub Fawkes network hub instance to use for network
00078  * communication.
00079  */
00080 void
00081 FawkesNetworkAspect::init_FawkesNetworkAspect(FawkesNetworkHub *fnethub)
00082 {
00083   this->fnethub = fnethub;
00084 }
00085 
00086 } // end namespace fawkes