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 
28 
29 namespace fawkes {
30 #if 0 /* just to make Emacs auto-indent happy */
31 }
32 #endif
33 
35 {
36  public:
37  BlackBoardWithOwnership(BlackBoard *parent, const char *owner);
38  virtual ~BlackBoardWithOwnership();
39 
40  virtual Interface * open_for_reading(const char *interface_type,
41  const char *identifier,
42  const char *owner = NULL);
43  virtual Interface * open_for_writing(const char *interface_type,
44  const char *identifier,
45  const char *owner = NULL);
46  virtual void close(Interface *interface);
47 
48  virtual InterfaceInfoList * list_all();
49  virtual InterfaceInfoList * list(const char *type_pattern,
50  const char *id_pattern);
51  virtual bool is_alive() const throw();
52  virtual bool try_aliveness_restore() throw();
53 
54  virtual std::list<Interface *>
55  open_multiple_for_reading(const char *type_pattern,
56  const char *id_pattern = "*",
57  const char *owner = NULL);
58 
59  virtual void register_listener(BlackBoardInterfaceListener *listener,
61  virtual void update_listener(BlackBoardInterfaceListener *listener,
63  virtual void unregister_listener(BlackBoardInterfaceListener *listener);
64 
65  virtual void register_observer(BlackBoardInterfaceObserver *observer);
66  virtual void unregister_observer(BlackBoardInterfaceObserver *observer);
67 
68  private: /* members */
69  BlackBoard *blackboard_;
70  std::string owner_;
71 };
72 
73 
74 } // end namespace fawkes
75 
76 #endif
virtual ~BlackBoardWithOwnership()
Destructor.
Definition: ownership.cpp:60
ListenerRegisterFlag
Flags to constrain listener registration/updates.
Definition: blackboard.h:98
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:82
Fawkes library namespace.
virtual void close(Interface *interface)
Close interface.
Definition: ownership.cpp:92
virtual Interface * open_for_reading(const char *interface_type, const char *identifier, const char *owner=NULL)
Open interface for reading.
Definition: ownership.cpp:66
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:79
virtual void unregister_listener(BlackBoardInterfaceListener *listener)
Unregister BB interface listener.
Definition: ownership.cpp:142
Interface information list.
virtual bool is_alive() const
Check if the BlackBoard is still alive.
Definition: ownership.cpp:113
BlackBoard that traces interface ownership.
Definition: ownership.h:34
virtual void unregister_observer(BlackBoardInterfaceObserver *observer)
Unregister BB interface observer.
Definition: ownership.cpp:157
BlackBoard interface observer.
BlackBoardWithOwnership(BlackBoard *parent, const char *owner)
Constructor.
Definition: ownership.cpp:47
virtual InterfaceInfoList * list_all()
Get list of all currently existing interfaces.
Definition: ownership.cpp:99
virtual bool try_aliveness_restore()
Try to restore the aliveness of the BlackBoard instance.
Definition: ownership.cpp:120
virtual void register_observer(BlackBoardInterfaceObserver *observer)
Register BB interface observer.
Definition: ownership.cpp:149
virtual void update_listener(BlackBoardInterfaceListener *listener, ListenerRegisterFlag flag=BBIL_FLAG_ALL)
Update BB event listener.
Definition: ownership.cpp:133
The BlackBoard abstract class.
Definition: blackboard.h:48
virtual Interface * open_for_writing(const char *interface_type, const char *identifier, const char *owner=NULL)
Open interface for writing.
Definition: ownership.cpp:74
virtual void register_listener(BlackBoardInterfaceListener *listener, ListenerRegisterFlag flag=BBIL_FLAG_ALL)
Register BB event listener.
Definition: ownership.cpp:126
virtual InterfaceInfoList * list(const char *type_pattern, const char *id_pattern)
Get list of interfaces matching type and ID patterns.
Definition: ownership.cpp:106
BlackBoard interface listener.