Fawkes API  Fawkes Development Version
local.h
1 
2 /***************************************************************************
3  * local.h - Local BlackBoard
4  *
5  * Created: Sat Sep 16 17:09:15 2006 (on train to Cologne)
6  * Copyright 2006-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_LOCAL_H_
24 #define __BLACKBOARD_LOCAL_H_
25 
26 #include <blackboard/blackboard.h>
27 #include <core/exceptions/software.h>
28 
29 #include <list>
30 
31 namespace fawkes {
32 
33 class BlackBoardInterfaceManager;
34 class BlackBoardMemoryManager;
35 class BlackBoardMessageManager;
36 class BlackBoardNetworkHandler;
37 class BlackBoardNotifier;
38 class Interface;
39 class InterfaceInfoList;
40 class BlackBoardInterfaceListener;
41 class BlackBoardInterfaceObserver;
42 class FawkesNetworkHub;
43 
45 {
46  public:
47  LocalBlackBoard(size_t memsize);
48  LocalBlackBoard(size_t memsize, const char *magic_token,
49  bool master = true);
50  virtual ~LocalBlackBoard();
51 
52  virtual Interface * open_for_reading(const char *interface_type,
53  const char *identifier,
54  const char *owner = NULL);
55  virtual Interface * open_for_writing(const char *interface_type,
56  const char *identifier,
57  const char *owner = NULL);
58  virtual void close(Interface *interface);
59 
60  virtual InterfaceInfoList * list_all();
61  virtual InterfaceInfoList * list(const char *type_pattern,
62  const char *id_pattern);
63  virtual bool is_alive() const throw();
64  virtual bool try_aliveness_restore() throw();
65 
66  virtual std::list<Interface *>
67  open_multiple_for_reading(const char *type_pattern,
68  const char *id_pattern = "*",
69  const char *owner = NULL);
70 
71  virtual void start_nethandler(FawkesNetworkHub *hub);
72 
73  static void cleanup(const char *magic_token, bool use_lister = false);
74 
75  /* for debugging only */
77 
78  private: /* members */
80  BlackBoardMemoryManager *__memmgr;
81  BlackBoardMessageManager *__msgmgr;
82  BlackBoardNetworkHandler *__nethandler;
83 };
84 
85 
86 } // end namespace fawkes
87 
88 #endif
LocalBlackBoard(size_t memsize)
Heap Memory Constructor.
Definition: local.cpp:73
virtual Interface * open_for_writing(const char *interface_type, const char *identifier, const char *owner=NULL)
Open interface for writing.
Definition: local.cpp:112
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: local.cpp:123
static void cleanup(const char *magic_token, bool use_lister=false)
Cleanup orphaned BlackBoard segments.
Definition: local.cpp:177
virtual InterfaceInfoList * list_all()
Get list of all currently existing interfaces.
Definition: local.cpp:143
Fawkes library namespace.
BlackBoard memory manager.
Local BlackBoard.
Definition: local.h:44
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:79
virtual Interface * open_for_reading(const char *interface_type, const char *identifier, const char *owner=NULL)
Open interface for reading.
Definition: local.cpp:101
Fawkes Network Hub.
Definition: hub.h:33
virtual void start_nethandler(FawkesNetworkHub *hub)
Start network handler.
Definition: local.cpp:209
Interface information list.
virtual InterfaceInfoList * list(const char *type_pattern, const char *id_pattern)
Get list of interfaces matching type and ID patterns.
Definition: local.cpp:150
virtual void close(Interface *interface)
Close interface.
Definition: local.cpp:136
virtual bool is_alive() const
Check if the BlackBoard is still alive.
Definition: local.cpp:157
BlackBoard message manager.
const BlackBoardMemoryManager * memory_manager() const
Get memory manager.
Definition: local.cpp:198
The BlackBoard abstract class.
Definition: blackboard.h:48
BlackBoard Network Handler.
Definition: handler.h:45
virtual ~LocalBlackBoard()
Destructor.
Definition: local.cpp:87
BlackBoard interface manager.
virtual bool try_aliveness_restore()
Try to restore the aliveness of the BlackBoard instance.
Definition: local.cpp:164