Fawkes API
Fawkes Development Version
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
All
Classes
Namespaces
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
writer_listener.cpp
1
2
/***************************************************************************
3
* writer_listener.cpp - Sync Writer Interface Listener
4
*
5
* Created: Fri Jun 05 16:16:22 2009
6
* Copyright 2006-2009 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.
14
*
15
* This program is distributed in the hope that it will be useful,
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
* GNU Library General Public License for more details.
19
*
20
* Read the full text in the LICENSE.GPL file in the doc directory.
21
*/
22
23
#include "writer_listener.h"
24
#include "sync_thread.h"
25
26
#include <blackboard/blackboard.h>
27
#include <logging/logger.h>
28
29
using namespace
fawkes;
30
31
/** @class SyncWriterInterfaceListener "writer_listener.h"
32
* Listener for writer events in bbsync plugin.
33
* This class provides an adapter which reacts to writer events for a given
34
* number of (reading) interfaces. Note that the listener is <i>not</i>
35
* automatically registered, this has to be done from the outside.
36
* @author Tim Niemueller
37
*/
38
39
/** Constructor.
40
* @param sync_thread parent sync thread to sent events to
41
* @param logger logger for informational output
42
* @param desc description for this interface combination
43
*/
44
SyncWriterInterfaceListener::SyncWriterInterfaceListener
(
BlackBoardSynchronizationThread
*sync_thread,
45
fawkes::Logger
*logger,
46
const
char
*desc)
47
:
BlackBoardInterfaceListener
(
"SyncWriterInterfaceListener(%s)"
, desc)
48
{
49
__logger = logger;
50
__sync_thread = sync_thread;
51
}
52
53
54
/** Add an interface to listen to.
55
* @param interface interface to listen to for writer events
56
*/
57
void
58
SyncWriterInterfaceListener::add_interface
(
Interface
*interface)
59
{
60
bbil_add_writer_interface
(interface);
61
}
62
63
64
/** Remove an interface to listen to.
65
* @param interface interface not to listen any longer for writer events
66
*/
67
void
68
SyncWriterInterfaceListener::remove_interface
(
Interface
*interface)
69
{
70
bbil_remove_writer_interface
(interface);
71
}
72
73
void
74
SyncWriterInterfaceListener::bb_interface_writer_added
(
fawkes::Interface
*interface,
75
unsigned
int
instance_serial)
throw
()
76
{
77
__sync_thread->writer_added(interface);
78
}
79
80
81
void
82
SyncWriterInterfaceListener::bb_interface_writer_removed
(
fawkes::Interface
*interface,
83
unsigned
int
instance_serial)
throw
()
84
{
85
__sync_thread->writer_removed(interface);
86
}
src
plugins
bbsync
writer_listener.cpp
Generated by
1.8.1.2