24 #include <interfaces/SkillerDebugInterface.h>
26 #include <core/exceptions/software.h>
47 SkillerDebugInterface::SkillerDebugInterface() : Interface()
49 data_size =
sizeof(SkillerDebugInterface_data_t);
50 data_ptr = malloc(data_size);
51 data = (SkillerDebugInterface_data_t *)data_ptr;
52 data_ts = (interface_data_ts_t *)data_ptr;
53 memset(data_ptr, 0, data_size);
54 add_fieldinfo(IFT_STRING,
"graph_fsm", 32, data->graph_fsm);
55 add_fieldinfo(IFT_STRING,
"graph", 8192, data->graph);
56 add_fieldinfo(IFT_ENUM,
"graph_dir", 1, &data->graph_dir,
"GraphDirectionEnum");
57 add_fieldinfo(IFT_BOOL,
"graph_colored", 1, &data->graph_colored);
58 add_messageinfo(
"SetGraphMessage");
59 add_messageinfo(
"SetGraphDirectionMessage");
60 add_messageinfo(
"SetGraphColoredMessage");
61 unsigned char tmp_hash[] = {0xcf, 0x3d, 0x2f, 0xf8, 0x80, 0x6e, 0x8f, 0xf4, 0x81, 0xa6, 0x7f, 0xd9, 0xb0, 0x29, 0xfc, 0x62};
66 SkillerDebugInterface::~SkillerDebugInterface()
78 case GD_TOP_BOTTOM:
return "GD_TOP_BOTTOM";
79 case GD_BOTTOM_TOP:
return "GD_BOTTOM_TOP";
80 case GD_LEFT_RIGHT:
return "GD_LEFT_RIGHT";
81 case GD_RIGHT_LEFT:
return "GD_RIGHT_LEFT";
82 default:
return "UNKNOWN";
93 SkillerDebugInterface::graph_fsm()
const
95 return data->graph_fsm;
103 SkillerDebugInterface::maxlenof_graph_fsm()
const
115 SkillerDebugInterface::set_graph_fsm(
const char * new_graph_fsm)
117 strncpy(data->graph_fsm, new_graph_fsm,
sizeof(data->graph_fsm));
128 SkillerDebugInterface::graph()
const
138 SkillerDebugInterface::maxlenof_graph()
const
150 SkillerDebugInterface::set_graph(
const char * new_graph)
152 strncpy(data->graph, new_graph,
sizeof(data->graph));
163 SkillerDebugInterface::graph_dir()
const
173 SkillerDebugInterface::maxlenof_graph_dir()
const
187 data->graph_dir = new_graph_dir;
198 SkillerDebugInterface::is_graph_colored()
const
200 return data->graph_colored;
208 SkillerDebugInterface::maxlenof_graph_colored()
const
220 SkillerDebugInterface::set_graph_colored(
const bool new_graph_colored)
222 data->graph_colored = new_graph_colored;
228 SkillerDebugInterface::create_message(
const char *type)
const
230 if ( strncmp(
"SetGraphMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
232 }
else if ( strncmp(
"SetGraphDirectionMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
234 }
else if ( strncmp(
"SetGraphColoredMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
238 "message type for this interface type.", type);
247 SkillerDebugInterface::copy_values(
const Interface *other)
252 type(), other->
type());
254 memcpy(data, oi->data,
sizeof(SkillerDebugInterface_data_t));
258 SkillerDebugInterface::enum_tostring(
const char *enumtype,
int val)
const
260 if (strcmp(enumtype,
"GraphDirectionEnum") == 0) {
277 SkillerDebugInterface::SetGraphMessage::SetGraphMessage(
const char * ini_graph_fsm) :
Message(
"SetGraphMessage")
279 data_size =
sizeof(SetGraphMessage_data_t);
282 data = (SetGraphMessage_data_t *)
data_ptr;
284 strncpy(data->graph_fsm, ini_graph_fsm, 32);
290 data_size =
sizeof(SetGraphMessage_data_t);
293 data = (SetGraphMessage_data_t *)
data_ptr;
312 data = (SetGraphMessage_data_t *)
data_ptr;
326 return data->graph_fsm;
348 strncpy(data->graph_fsm, new_graph_fsm,
sizeof(data->graph_fsm));
373 data_size =
sizeof(SetGraphDirectionMessage_data_t);
376 data = (SetGraphDirectionMessage_data_t *)
data_ptr;
378 data->graph_dir = ini_graph_dir;
384 data_size =
sizeof(SetGraphDirectionMessage_data_t);
387 data = (SetGraphDirectionMessage_data_t *)
data_ptr;
406 data = (SetGraphDirectionMessage_data_t *)
data_ptr;
442 data->graph_dir = new_graph_dir;
467 data_size =
sizeof(SetGraphColoredMessage_data_t);
470 data = (SetGraphColoredMessage_data_t *)
data_ptr;
472 data->graph_colored = ini_graph_colored;
478 data_size =
sizeof(SetGraphColoredMessage_data_t);
481 data = (SetGraphColoredMessage_data_t *)
data_ptr;
500 data = (SetGraphColoredMessage_data_t *)
data_ptr;
514 return data->graph_colored;
536 data->graph_colored = new_graph_colored;
SkillerDebugInterface Fawkes BlackBoard Interface.
void * data_ptr
Pointer to memory that contains local data.
Base class for all messages passed through interfaces in Fawkes BlackBoard.
virtual Message * clone() const
Clone this message.
size_t maxlenof_graph_dir() const
Get maximum length of graph_dir value.
Timestamp data, must be present and first entries for each interface data structs! This leans on time...
virtual Message * clone() const
Clone this message.
size_t maxlenof_graph_fsm() const
Get maximum length of graph_fsm value.
GraphDirectionEnum graph_dir() const
Get graph_dir value.
~SetGraphDirectionMessage()
Destructor.
void set_graph_colored(const bool new_graph_colored)
Set graph_colored value.
SetGraphMessage Fawkes BlackBoard Interface Message.
Base class for all Fawkes BlackBoard interfaces.
char * graph_fsm() const
Get graph_fsm value.
void set_graph_fsm(const char *new_graph_fsm)
Set graph_fsm value.
message_data_ts_t * data_ts
data timestamp aliasing pointer
unsigned int data_size
Size of memory needed to hold all data.
void * data_ptr
Pointer to local memory storage.
GraphDirectionEnum
Primary direction of the graph.
~SetGraphColoredMessage()
Destructor.
size_t maxlenof_graph_colored() const
Get maximum length of graph_colored value.
~SetGraphMessage()
Destructor.
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.
SetGraphColoredMessage Fawkes BlackBoard Interface Message.
SetGraphDirectionMessage()
Constructor.
void set_graph_dir(const GraphDirectionEnum new_graph_dir)
Set graph_dir value.
virtual Message * clone() const
Clone this message.
void add_fieldinfo(interface_fieldtype_t type, const char *name, size_t length, void *value, const char *enumtype=0)
Add an entry to the info list.
SetGraphMessage()
Constructor.
bool is_graph_colored() const
Get graph_colored value.
SetGraphDirectionMessage Fawkes BlackBoard Interface Message.
const char * type() const
Get type of interface.
SetGraphColoredMessage()
Constructor.
field with interface specific enum type