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 
35 {
36 
37  friend class BlackBoardNotifier;
38 
39  public:
42 
43  virtual void bb_interface_created(const char *type, const char *id) throw();
44  virtual void bb_interface_destroyed(const char *type, const char *id) throw();
45 
46  protected:
47  void bbio_add_observed_create(const char *type_pattern,
48  const char *id_pattern = "*") throw();
49  void bbio_add_observed_destroy(const char *type_pattern,
50  const char *id_pattern = "*") throw();
51 
52  /** Type for lockable interface type hash sets. */
54 
55  /** Type for iterator of lockable interface type hash sets. */
56  typedef ObservedInterfaceLockMap::iterator ObservedInterfaceLockMapIterator;
57 
58  ObservedInterfaceLockMap * bbio_get_observed_create() throw();
59  ObservedInterfaceLockMap * bbio_get_observed_destroy() throw();
60 
61  private:
62  ObservedInterfaceLockMap __bbio_observed_create;
63  ObservedInterfaceLockMap __bbio_observed_destroy;
64  ObservedInterfaceLockMapIterator __bbio_iti;
65 };
66 
67 } // end namespace fawkes
68 
69 #endif
ObservedInterfaceLockMap::iterator ObservedInterfaceLockMapIterator
Type for iterator of lockable interface type hash sets.
ObservedInterfaceLockMap * bbio_get_observed_destroy()
Get interface destriction type watch list.
virtual void bb_interface_destroyed(const char *type, const char *id)
BlackBoard interface destroyed notification.
Fawkes library namespace.
BlackBoardInterfaceObserver()
Empty constructor.
BlackBoard notifier.
Definition: notifier.h:43
void bbio_add_observed_destroy(const char *type_pattern, const char *id_pattern="*")
Add interface destruction type to watch list.
Map with a lock.
Definition: lock_map.h:37
void bbio_add_observed_create(const char *type_pattern, const char *id_pattern="*")
Add interface creation type to watch list.
BlackBoard interface observer.
virtual ~BlackBoardInterfaceObserver()
Destructor.
ObservedInterfaceLockMap * bbio_get_observed_create()
Get interface creation type watch list.
virtual void bb_interface_created(const char *type, const char *id)
BlackBoard interface created notification.
LockMap< std::string, std::list< std::string > > ObservedInterfaceLockMap
Type for lockable interface type hash sets.