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, bool master = true);
49  virtual ~LocalBlackBoard();
50 
51  virtual Interface *
52  open_for_reading(const char *interface_type, const char *identifier, const char *owner = NULL);
53  virtual Interface *
54  open_for_writing(const char *interface_type, const char *identifier, const char *owner = NULL);
55  virtual void close(Interface *interface);
56 
57  virtual InterfaceInfoList *list_all();
58  virtual InterfaceInfoList *list(const char *type_pattern, const char *id_pattern);
59  virtual bool is_alive() const throw();
60  virtual bool try_aliveness_restore() throw();
61 
62  virtual std::list<Interface *> open_multiple_for_reading(const char *type_pattern,
63  const char *id_pattern = "*",
64  const char *owner = NULL);
65 
66  virtual void start_nethandler(FawkesNetworkHub *hub);
67 
68  static void cleanup(const char *magic_token, bool use_lister = false);
69 
70  /* for debugging only */
72 
73 private: /* members */
75  BlackBoardMemoryManager * memmgr_;
76  BlackBoardMessageManager * msgmgr_;
77  BlackBoardNetworkHandler * nethandler_;
78 };
79 
80 } // end namespace fawkes
81 
82 #endif
LocalBlackBoard(size_t memsize)
Heap Memory Constructor.
Definition: local.cpp:70
virtual Interface * open_for_writing(const char *interface_type, const char *identifier, const char *owner=NULL)
Open interface for writing.
Definition: local.cpp:106
static void cleanup(const char *magic_token, bool use_lister=false)
Cleanup orphaned BlackBoard segments.
Definition: local.cpp:164
virtual InterfaceInfoList * list_all()
Get list of all currently existing interfaces.
Definition: local.cpp:134
Fawkes library namespace.
BlackBoard memory manager.
Local BlackBoard.
Definition: local.h:44
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:78
virtual Interface * open_for_reading(const char *interface_type, const char *identifier, const char *owner=NULL)
Open interface for reading.
Definition: local.cpp:96
Fawkes Network Hub.
Definition: hub.h:33
virtual void start_nethandler(FawkesNetworkHub *hub)
Start network handler.
Definition: local.cpp:194
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:140
virtual void close(Interface *interface)
Close interface.
Definition: local.cpp:128
virtual bool is_alive() const
Check if the BlackBoard is still alive.
Definition: local.cpp:146
BlackBoard message manager.
const BlackBoardMemoryManager * memory_manager() const
Get memory manager.
Definition: local.cpp:184
The BlackBoard abstract class.
Definition: blackboard.h:45
BlackBoard Network Handler.
Definition: handler.h:42
virtual ~LocalBlackBoard()
Destructor.
Definition: local.cpp:83
BlackBoard interface manager.
virtual bool try_aliveness_restore()
Try to restore the aliveness of the BlackBoard instance.
Definition: local.cpp:152