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 #include <netcomm/fawkes/hub.h>
26 
27 namespace fawkes {
28 
29 /** @class FawkesNetworkAspect <aspect/fawkes_network.h>
30  * Thread aspect to participate in the Fawkes Network protocol.
31  * Give this aspect to your thread to make use of the Fawkes network
32  * protocol. The protocol is designed to transport short messages over
33  * the network (information and control data).
34  * With this aspect you can easily inject messages into the stream and
35  * and receive messages from connected clients. The component ID has to
36  * be unique. To ensure this have a look at netcomm/fawkes/component_ids.h.
37  *
38  * It is guaranteed that if used properly from within plugins that
39  * initFawkesNetworkAspect() is called before the thread is started and that
40  * you can access the Fawkes network hub via the fnethub member.
41  *
42  * In most cases you should implement Thread::init() to register
43  * your FawkesNetworkHandler.
44  *
45  * @ingroup Aspects
46  * @author Tim Niemueller
47  */
48 
49 /** @var FawkesNetworkHub FawkesNetworkAspect::fnethub
50  * This is the Fawkes network hub member used to access the Fawkes
51  * network protocol.
52  * The logger will remain valid for the whole lifetime of the
53  * thread.
54  */
55 
56 /** Constructor. */
58 {
59  add_aspect("FawkesNetworkAspect");
60 }
61 
62 /** Virtual empty Destructor. */
64 {
65 }
66 
67 /** Set the logger.
68  * It is guaranteed that this is called for a thread having the
69  * Fawkes netwok aspect before Thread::start() is called (when
70  * running regularly inside Fawkes).
71  * @param fnethub Fawkes network hub instance to use for network
72  * communication.
73  */
74 void
76 {
77  this->fnethub = fnethub;
78 }
79 
80 } // end namespace fawkes
void add_aspect(const char *name)
Add an aspect to a thread.
Definition: aspect.cpp:49
void init_FawkesNetworkAspect(FawkesNetworkHub *fnethub)
Set the logger.
FawkesNetworkHub * fnethub
This is the Fawkes network hub member used to access the Fawkes network protocol.
virtual ~FawkesNetworkAspect()
Virtual empty Destructor.
Fawkes Network Hub.
Definition: hub.h:34
Fawkes library namespace.