Fawkes API Fawkes Development Version
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
25#include "sync_thread.h"
26
27#include <blackboard/blackboard.h>
28#include <logging/logger.h>
29
30using namespace fawkes;
31
32/** @class SyncWriterInterfaceListener "writer_listener.h"
33 * Listener for writer events in bbsync plugin.
34 * This class provides an adapter which reacts to writer events for a given
35 * number of (reading) interfaces. Note that the listener is <i>not</i>
36 * automatically registered, this has to be done from the outside.
37 * @author Tim Niemueller
38 */
39
40/** Constructor.
41 * @param sync_thread parent sync thread to sent events to
42 * @param logger logger for informational output
43 * @param desc description for this interface combination
44 */
47 fawkes::Logger * logger,
48 const char * desc)
49: BlackBoardInterfaceListener("SyncWriterInterfaceListener(%s)", desc)
50{
51 logger_ = logger;
52 sync_thread_ = sync_thread;
53}
54
55/** Add an interface to listen to.
56 * @param interface interface to listen to for writer events
57 */
58void
60{
62}
63
64/** Remove an interface to listen to.
65 * @param interface interface not to listen any longer for writer events
66 */
67void
69{
71}
72
73void
75 fawkes::Uuid instance_serial) noexcept
76{
77 sync_thread_->writer_added(interface);
78}
79
80void
82 fawkes::Uuid instance_serial) noexcept
83{
84 sync_thread_->writer_removed(interface);
85}
Thread to synchronize two BlackBoards.
Definition: sync_thread.h:49
SyncWriterInterfaceListener(BlackBoardSynchronizationThread *sync_thread, fawkes::Logger *logger, const char *desc)
Constructor.
void add_interface(fawkes::Interface *interface)
Add an interface to listen to.
virtual void bb_interface_writer_removed(fawkes::Interface *interface, fawkes::Uuid instance_serial) noexcept
A writing instance has been closed for a watched interface.
virtual void bb_interface_writer_added(fawkes::Interface *interface, fawkes::Uuid instance_serial) noexcept
A writing instance has been opened for a watched interface.
void remove_interface(fawkes::Interface *interface)
Remove an interface to listen to.
BlackBoard interface listener.
void bbil_remove_writer_interface(Interface *interface)
Remove an interface to the writer addition/removal watch list.
void bbil_add_writer_interface(Interface *interface)
Add an interface to the writer addition/removal watch list.
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:80
Interface for logging.
Definition: logger.h:42
A convenience class for universally unique identifiers (UUIDs).
Definition: uuid.h:29
Fawkes library namespace.