24 #ifndef __BLACKBOARD_BLACKBOARD_H_
25 #define __BLACKBOARD_BLACKBOARD_H_
27 #include <core/exceptions/software.h>
28 #include <interface/interface.h>
39 class BlackBoardInterfaceManager;
40 class BlackBoardMemoryManager;
41 class BlackBoardMessageManager;
42 class BlackBoardNetworkHandler;
43 class BlackBoardNotifier;
44 class InterfaceInfoList;
45 class BlackBoardInterfaceListener;
46 class BlackBoardInterfaceObserver;
47 class FawkesNetworkHub;
55 virtual Interface * open_for_reading(
const char *interface_type,
56 const char *identifier) = 0;
57 virtual Interface * open_for_writing(
const char *interface_type,
58 const char *identifier) = 0;
59 virtual void close(
Interface *interface) = 0;
63 const char *id_pattern) = 0;
64 virtual bool is_alive()
const throw() = 0;
65 virtual bool try_aliveness_restore()
throw() = 0;
67 virtual std::list<Interface *>
68 open_multiple_for_reading(
const char *type_pattern,
69 const char *id_pattern =
"*") = 0;
71 template <
class InterfaceType>
72 std::list<InterfaceType *>
73 open_multiple_for_reading(
const char *id_pattern =
"*");
75 template <
class InterfaceType>
76 InterfaceType * open_for_reading(
const char *identifier);
78 template <
class InterfaceType>
79 InterfaceType * open_for_writing(
const char *identifier);
84 BBIL_FLAG_MESSAGES = 2,
88 } ListenerRegisterFlag;
91 ListenerRegisterFlag flag = BBIL_FLAG_ALL);
93 ListenerRegisterFlag flag = BBIL_FLAG_ALL);
99 std::string demangle_fawkes_interface_name(
const char *type);
119 template <
class InterfaceType>
121 BlackBoard::open_for_reading(
const char *identifier)
123 std::string type_name =
124 demangle_fawkes_interface_name(
typeid(InterfaceType).name());
125 Interface *
interface = open_for_reading(type_name.c_str(), identifier);
126 return static_cast<InterfaceType *
>(interface);
139 template <
class InterfaceType>
140 std::list<InterfaceType *>
141 BlackBoard::open_multiple_for_reading(
const char *id_pattern)
143 std::string type_name =
144 demangle_fawkes_interface_name(
typeid(InterfaceType).name());
145 std::list<Interface *> il =
146 open_multiple_for_reading(type_name.c_str(), id_pattern);
147 std::list<InterfaceType *> rv;
148 for (std::list<Interface *>::iterator i = il.begin(); i != il.end(); ++i) {
149 rv.push_back(static_cast<InterfaceType *>(*i));
171 template <
class InterfaceType>
173 BlackBoard::open_for_writing(
const char *identifier)
175 std::string type_name =
176 demangle_fawkes_interface_name(
typeid(InterfaceType).name());
177 Interface *
interface = open_for_writing(type_name.c_str(), identifier);
178 return static_cast<InterfaceType *
>(interface);;
200 inline BlackBoard::ListenerRegisterFlag