Fawkes API  Fawkes Development Version
interface_observer.h
1 
2 /***************************************************************************
3  * interface_observer.h - BlackBoard interface observer
4  *
5  * Created: Fri Jan 25 18:19:00 2008 (Just back from Hacking with Fawkes talk)
6  * Copyright 2007-2008 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. A runtime exception applies to
14  * this software (see LICENSE.GPL_WRE file mentioned below for details).
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Library General Public License for more details.
20  *
21  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22  */
23 
24 #ifndef _BLACKBOARD_INTERFACE_OBSERVER_H_
25 #define _BLACKBOARD_INTERFACE_OBSERVER_H_
26 
27 #include <core/utils/lock_map.h>
28 
29 #include <list>
30 #include <string>
31 
32 namespace fawkes {
33 
34 class BlackBoardNotifier;
35 
37 {
38  friend BlackBoardNotifier;
39 
40 public:
43 
44  virtual void bb_interface_created(const char *type, const char *id) throw();
45  virtual void bb_interface_destroyed(const char *type, const char *id) throw();
46 
47 protected:
48  void bbio_add_observed_create(const char *type_pattern, const char *id_pattern = "*") throw();
49  void bbio_add_observed_destroy(const char *type_pattern, const char *id_pattern = "*") throw();
50 
51  /** Type for lockable interface type hash sets. */
53 
54  /** Type for iterator of lockable interface type hash sets. */
55  typedef ObservedInterfaceLockMap::iterator ObservedInterfaceLockMapIterator;
56 
59 
60 private:
61  ObservedInterfaceLockMap bbio_observed_create_;
62  ObservedInterfaceLockMap bbio_observed_destroy_;
64 };
65 
66 } // end namespace fawkes
67 
68 #endif
fawkes::BlackBoardInterfaceObserver::bbio_add_observed_destroy
void bbio_add_observed_destroy(const char *type_pattern, const char *id_pattern="*")
Add interface destruction type to watch list.
Definition: interface_observer.cpp:138
fawkes::BlackBoardInterfaceObserver::bb_interface_destroyed
virtual void bb_interface_destroyed(const char *type, const char *id)
BlackBoard interface destroyed notification.
Definition: interface_observer.cpp:106
fawkes::LockMap
Map with a lock.
Definition: lock_map.h:36
fawkes::BlackBoardInterfaceObserver::BlackBoardInterfaceObserver
BlackBoardInterfaceObserver()
Empty constructor.
Definition: interface_observer.cpp:69
fawkes::BlackBoardInterfaceObserver::ObservedInterfaceLockMap
LockMap< std::string, std::list< std::string > > ObservedInterfaceLockMap
Type for lockable interface type hash sets.
Definition: interface_observer.h:52
fawkes::BlackBoardInterfaceObserver::bbio_get_observed_destroy
ObservedInterfaceLockMap * bbio_get_observed_destroy()
Get interface destriction type watch list.
Definition: interface_observer.cpp:161
fawkes::BlackBoardInterfaceObserver::bbio_add_observed_create
void bbio_add_observed_create(const char *type_pattern, const char *id_pattern="*")
Add interface creation type to watch list.
Definition: interface_observer.cpp:119
fawkes
Fawkes library namespace.
fawkes::BlackBoardInterfaceObserver::~BlackBoardInterfaceObserver
virtual ~BlackBoardInterfaceObserver()
Destructor.
Definition: interface_observer.cpp:74
fawkes::BlackBoardInterfaceObserver
BlackBoard interface observer.
Definition: interface_observer.h:37
fawkes::BlackBoardInterfaceObserver::bbio_get_observed_create
ObservedInterfaceLockMap * bbio_get_observed_create()
Get interface creation type watch list.
Definition: interface_observer.cpp:152
fawkes::BlackBoardNotifier
BlackBoard notifier.
Definition: notifier.h:43
fawkes::BlackBoardInterfaceObserver::bb_interface_created
virtual void bb_interface_created(const char *type, const char *id)
BlackBoard interface created notification.
Definition: interface_observer.cpp:91
fawkes::BlackBoardInterfaceObserver::ObservedInterfaceLockMapIterator
ObservedInterfaceLockMap::iterator ObservedInterfaceLockMapIterator
Type for iterator of lockable interface type hash sets.
Definition: interface_observer.h:55