Fawkes API  Fawkes Development Version
fawkes_network.cpp
1 
2 /***************************************************************************
3  * fawkes_network.cpp - Fawkes network aspect for Fawkes
4  *
5  * Created: Mon May 07 19:45:32 2007
6  * Copyright 2006-2010 Tim Niemueller [www.niemueller.de]
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version. A runtime exception applies to
14  * this software (see LICENSE.GPL_WRE file mentioned below for details).
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Library General Public License for more details.
20  *
21  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22  */
23 
24 #include <aspect/fawkes_network.h>
25 
26 #include <netcomm/fawkes/hub.h>
27 
28 namespace fawkes {
29 #if 0 /* just to make Emacs auto-indent happy */
30 }
31 #endif
32 
33 /** @class FawkesNetworkAspect <aspect/fawkes_network.h>
34  * Thread aspect to participate in the Fawkes Network protocol.
35  * Give this aspect to your thread to make use of the Fawkes network
36  * protocol. The protocol is designed to transport short messages over
37  * the network (information and control data).
38  * With this aspect you can easily inject messages into the stream and
39  * and receive messages from connected clients. The component ID has to
40  * be unique. To ensure this have a look at netcomm/fawkes/component_ids.h.
41  *
42  * It is guaranteed that if used properly from within plugins that
43  * initFawkesNetworkAspect() is called before the thread is started and that
44  * you can access the Fawkes network hub via the fnethub member.
45  *
46  * In most cases you should implement Thread::init() to register
47  * your FawkesNetworkHandler.
48  *
49  * @ingroup Aspects
50  * @author Tim Niemueller
51  */
52 
53 
54 /** @var FawkesNetworkHub FawkesNetworkAspect::fnethub
55  * This is the Fawkes network hub member used to access the Fawkes
56  * network protocol.
57  * The logger will remain valid for the whole lifetime of the
58  * thread.
59  */
60 
61 /** Constructor. */
63 {
64  add_aspect("FawkesNetworkAspect");
65 }
66 
67 /** Virtual empty Destructor. */
69 {
70 }
71 
72 
73 /** Set the logger.
74  * It is guaranteed that this is called for a thread having the
75  * Fawkes netwok aspect before Thread::start() is called (when
76  * running regularly inside Fawkes).
77  * @param fnethub Fawkes network hub instance to use for network
78  * communication.
79  */
80 void
82 {
83  this->fnethub = fnethub;
84 }
85 
86 } // end namespace fawkes
FawkesNetworkHub * fnethub
This is the Fawkes network hub member used to access the Fawkes network protocol. ...
Fawkes library namespace.
void add_aspect(const char *name)
Add an aspect to a thread.
Definition: aspect.cpp:52
FawkesNetworkAspect()
Constructor.
void init_FawkesNetworkAspect(FawkesNetworkHub *fnethub)
Set the logger.
Fawkes Network Hub.
Definition: hub.h:33
virtual ~FawkesNetworkAspect()
Virtual empty Destructor.