Fawkes API Fawkes Development Version
ownership.h
1
2/***************************************************************************
3 * ownership.h - BlackBoard with traced ownership
4 *
5 * Created: Thu Jan 22 15:16:15 2015
6 * Copyright 2015 Tim Niemueller [www.niemueller.de]
7 ****************************************************************************/
8
9/* This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version. A runtime exception applies to
13 * this software (see LICENSE.GPL_WRE file mentioned below for details).
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_WRE file in the doc directory.
21 */
22
23#ifndef _BLACKBOARD_OWNERSHIP_H_
24#define _BLACKBOARD_OWNERSHIP_H_
25
26#include <blackboard/blackboard.h>
27
28namespace fawkes {
29
31{
32public:
33 BlackBoardWithOwnership(BlackBoard *parent, const char *owner);
35
36 virtual Interface *
37 open_for_reading(const char *interface_type, const char *identifier, const char *owner = NULL);
38 virtual Interface *
39 open_for_writing(const char *interface_type, const char *identifier, const char *owner = NULL);
40 virtual void close(Interface *interface);
41
42 virtual InterfaceInfoList *list_all();
43 virtual InterfaceInfoList *list(const char *type_pattern, const char *id_pattern);
44 virtual bool is_alive() const noexcept;
45 virtual bool try_aliveness_restore() noexcept;
46
47 virtual std::list<Interface *> open_multiple_for_reading(const char *type_pattern,
48 const char *id_pattern = "*",
49 const char *owner = NULL);
50
53 virtual void update_listener(BlackBoardInterfaceListener *listener,
56
57 virtual void register_observer(BlackBoardInterfaceObserver *observer);
59
60private: /* members */
61 BlackBoard *blackboard_;
62 std::string owner_;
63};
64
65} // end namespace fawkes
66
67#endif
BlackBoard interface listener.
BlackBoard interface observer.
BlackBoard that traces interface ownership.
Definition: ownership.h:31
virtual Interface * open_for_writing(const char *interface_type, const char *identifier, const char *owner=NULL)
Open interface for writing.
Definition: ownership.cpp:68
virtual void close(Interface *interface)
Close interface.
Definition: ownership.cpp:86
virtual void register_observer(BlackBoardInterfaceObserver *observer)
Register BB interface observer.
Definition: ownership.cpp:140
virtual void unregister_observer(BlackBoardInterfaceObserver *observer)
Unregister BB interface observer.
Definition: ownership.cpp:148
virtual void update_listener(BlackBoardInterfaceListener *listener, ListenerRegisterFlag flag=BBIL_FLAG_ALL)
Update BB event listener.
Definition: ownership.cpp:123
virtual InterfaceInfoList * list_all()
Get list of all currently existing interfaces.
Definition: ownership.cpp:92
virtual ~BlackBoardWithOwnership()
Destructor.
Definition: ownership.cpp:55
virtual void unregister_listener(BlackBoardInterfaceListener *listener)
Unregister BB interface listener.
Definition: ownership.cpp:132
virtual Interface * open_for_reading(const char *interface_type, const char *identifier, const char *owner=NULL)
Open interface for reading.
Definition: ownership.cpp:60
virtual bool is_alive() const noexcept
Check if the BlackBoard is still alive.
Definition: ownership.cpp:104
BlackBoardWithOwnership(BlackBoard *parent, const char *owner)
Constructor.
Definition: ownership.cpp:43
virtual void register_listener(BlackBoardInterfaceListener *listener, ListenerRegisterFlag flag=BBIL_FLAG_ALL)
Register BB event listener.
Definition: ownership.cpp:116
virtual bool try_aliveness_restore() noexcept
Try to restore the aliveness of the BlackBoard instance.
Definition: ownership.cpp:110
virtual std::list< Interface * > open_multiple_for_reading(const char *type_pattern, const char *id_pattern="*", const char *owner=NULL)
Open multiple interfaces for reading.
Definition: ownership.cpp:76
virtual InterfaceInfoList * list(const char *type_pattern, const char *id_pattern)
Get list of interfaces matching type and ID patterns.
Definition: ownership.cpp:98
The BlackBoard abstract class.
Definition: blackboard.h:46
ListenerRegisterFlag
Flags to constrain listener registration/updates.
Definition: blackboard.h:87
@ BBIL_FLAG_ALL
consider all events
Definition: blackboard.h:92
Interface information list.
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:80
Fawkes library namespace.