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,
60  ListenerRegisterFlag flag = BBIL_FLAG_ALL);
61  virtual void update_listener(BlackBoardInterfaceListener *listener,
62  ListenerRegisterFlag flag = BBIL_FLAG_ALL);
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
ListenerRegisterFlag
Flags to constrain listener registration/updates.
Definition: blackboard.h:98
Fawkes library namespace.
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:79
Interface information list.
BlackBoard that traces interface ownership.
Definition: ownership.h:34
BlackBoard interface observer.
The BlackBoard abstract class.
Definition: blackboard.h:48
BlackBoard interface listener.