Fawkes API  Fawkes Development Version
blackboard.h
1 
2 /***************************************************************************
3  * blackboard.h - External predicates to remotely access the Fawkes
4  * blackboard
5  *
6  * Created: Wed Mar 09 16:57:03 2011
7  * Copyright 2011 Daniel Beck
8  *
9  ****************************************************************************/
10 
11 /* This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
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 file in the doc directory.
22  */
23 
24 #ifndef __ECLIPSE_EXTERNALS_BLACKBOARD_H_
25 #define __ECLIPSE_EXTERNALS_BLACKBOARD_H_
26 
27 #include <blackboard/remote.h>
28 #include <vector>
29 
30 #include <cstdio>
31 
32 /** @class fawkes::EclExternalBlackBoard
33  * Wrapper class for using the blackboard in the implementation of the external
34  * predicates.
35  * @author Daniel Beck
36  */
37 namespace fawkes
38 {
40 {
41 private:
42  /** Constructor. */
44 
45  /** Constructor.
46  * @param blackboard blackboard to use to open interfaces
47  */
48  EclExternalBlackBoard(BlackBoard *blackboard);
49 public:
50  /** Destructor. */
52 
53  static void create_initial_object(BlackBoard *bb);
54  static void cleanup_instance();
56 
57  void connect(const char *host, long port);
58  bool connected();
59  void disconnect();
61  std::map<std::string, Interface *> & interfaces();
62 
63 private:
64  static EclExternalBlackBoard * m_instance;
65  std::map<std::string, Interface *> m_interfaces;
66  static BlackBoard * m_blackboard;
67  bool m_own_blackboard;
68 };
69 }
70 
71 
72 extern "C" int p_bb_connect_to_remote_blackboard();
73 extern "C" int p_bb_disconnect_from_blackboard();
74 extern "C" int p_bb_is_alive();
75 extern "C" int p_bb_is_connected();
76 
77 extern "C" int p_bb_open_interface();
78 extern "C" int p_bb_close_interface();
79 
80 extern "C" int p_bb_has_writer();
81 extern "C" int p_bb_instance_serial();
82 
83 extern "C" int p_bb_read_interfaces();
84 extern "C" int p_bb_read_interface();
85 extern "C" int p_bb_write_interfaces();
86 extern "C" int p_bb_write_interface();
87 extern "C" int p_bb_interface_changed();
88 
89 extern "C" int p_bb_get();
90 extern "C" int p_bb_set();
91 
92 extern "C" int p_bb_send_message();
93 extern "C" int p_bb_recv_messages();
94 
95 #endif
96 
Fawkes library namespace.
std::map< std::string, Interface * > & interfaces()
Obtain the list of opened interfaces.
Definition: blackboard.cpp:156
static BlackBoard * blackboard_instance()
Access the BlackBoard instance.
Definition: blackboard.cpp:145
static void cleanup_instance()
Delete the current EclExternalBlackBoard instance and set it to NULL.
Definition: blackboard.cpp:85
static void create_initial_object(BlackBoard *bb)
Creates the initial EclExternalBlackBoard object.
Definition: blackboard.cpp:79
static EclExternalBlackBoard * instance()
Get the EclExternalBlackBoard instance.
Definition: blackboard.cpp:97
void disconnect()
Disconnect remote blackboard connection.
Definition: blackboard.cpp:130
Wrapper class for using the blackboard in the implementation of the external predicates.
Definition: blackboard.h:39
~EclExternalBlackBoard()
Destructor.
Definition: blackboard.cpp:65
bool connected()
Query connection status.
Definition: blackboard.cpp:124
void connect(const char *host, long port)
Open remote blackboard connection.
Definition: blackboard.cpp:112
The BlackBoard abstract class.
Definition: blackboard.h:48