24 #include <interfaces/SkillerDebugInterface.h> 26 #include <core/exceptions/software.h> 49 SkillerDebugInterface::SkillerDebugInterface() : Interface()
51 data_size =
sizeof(SkillerDebugInterface_data_t);
52 data_ptr = malloc(data_size);
53 data = (SkillerDebugInterface_data_t *)data_ptr;
54 data_ts = (interface_data_ts_t *)data_ptr;
55 memset(data_ptr, 0, data_size);
56 enum_map_GraphDirectionEnum[(int)GD_TOP_BOTTOM] =
"GD_TOP_BOTTOM";
57 enum_map_GraphDirectionEnum[(int)GD_BOTTOM_TOP] =
"GD_BOTTOM_TOP";
58 enum_map_GraphDirectionEnum[(int)GD_LEFT_RIGHT] =
"GD_LEFT_RIGHT";
59 enum_map_GraphDirectionEnum[(int)GD_RIGHT_LEFT] =
"GD_RIGHT_LEFT";
60 add_fieldinfo(IFT_STRING,
"graph_fsm", 32, data->graph_fsm);
61 add_fieldinfo(IFT_STRING,
"graph", 8192, data->graph);
62 add_fieldinfo(IFT_ENUM,
"graph_dir", 1, &data->graph_dir,
"GraphDirectionEnum", &enum_map_GraphDirectionEnum);
63 add_fieldinfo(IFT_BOOL,
"graph_colored", 1, &data->graph_colored);
64 add_messageinfo(
"SetGraphMessage");
65 add_messageinfo(
"SetGraphDirectionMessage");
66 add_messageinfo(
"SetGraphColoredMessage");
67 unsigned char tmp_hash[] = {0xcf, 0x3d, 0x2f, 0xf8, 0x80, 0x6e, 0x8f, 0xf4, 0x81, 0xa6, 0x7f, 0xd9, 0xb0, 0x29, 0xfc, 0x62};
72 SkillerDebugInterface::~SkillerDebugInterface()
84 case GD_TOP_BOTTOM:
return "GD_TOP_BOTTOM";
85 case GD_BOTTOM_TOP:
return "GD_BOTTOM_TOP";
86 case GD_LEFT_RIGHT:
return "GD_LEFT_RIGHT";
87 case GD_RIGHT_LEFT:
return "GD_RIGHT_LEFT";
88 default:
return "UNKNOWN";
99 SkillerDebugInterface::graph_fsm()
const 101 return data->graph_fsm;
109 SkillerDebugInterface::maxlenof_graph_fsm()
const 121 SkillerDebugInterface::set_graph_fsm(
const char * new_graph_fsm)
123 strncpy(data->graph_fsm, new_graph_fsm,
sizeof(data->graph_fsm)-1);
124 data->graph_fsm[
sizeof(data->graph_fsm)-1] = 0;
135 SkillerDebugInterface::graph()
const 145 SkillerDebugInterface::maxlenof_graph()
const 157 SkillerDebugInterface::set_graph(
const char * new_graph)
159 strncpy(data->graph, new_graph,
sizeof(data->graph)-1);
160 data->graph[
sizeof(data->graph)-1] = 0;
171 SkillerDebugInterface::graph_dir()
const 181 SkillerDebugInterface::maxlenof_graph_dir()
const 195 data->graph_dir = new_graph_dir;
206 SkillerDebugInterface::is_graph_colored()
const 208 return data->graph_colored;
216 SkillerDebugInterface::maxlenof_graph_colored()
const 228 SkillerDebugInterface::set_graph_colored(
const bool new_graph_colored)
230 data->graph_colored = new_graph_colored;
236 SkillerDebugInterface::create_message(
const char *type)
const 238 if ( strncmp(
"SetGraphMessage", type, INTERFACE_MESSAGE_TYPE_SIZE_) == 0 ) {
240 }
else if ( strncmp(
"SetGraphDirectionMessage", type, INTERFACE_MESSAGE_TYPE_SIZE_) == 0 ) {
242 }
else if ( strncmp(
"SetGraphColoredMessage", type, INTERFACE_MESSAGE_TYPE_SIZE_) == 0 ) {
246 "message type for this interface type.", type);
255 SkillerDebugInterface::copy_values(
const Interface *other)
260 type(), other->
type());
262 memcpy(data, oi->data,
sizeof(SkillerDebugInterface_data_t));
266 SkillerDebugInterface::enum_tostring(
const char *enumtype,
int val)
const 268 if (strcmp(enumtype,
"GraphDirectionEnum") == 0) {
285 SkillerDebugInterface::SetGraphMessage::SetGraphMessage(
const char * ini_graph_fsm) :
Message(
"SetGraphMessage")
287 data_size =
sizeof(SetGraphMessage_data_t);
290 data = (SetGraphMessage_data_t *)
data_ptr;
292 strncpy(data->graph_fsm, ini_graph_fsm, 32-1);
293 data->graph_fsm[32-1] = 0;
294 enum_map_GraphDirectionEnum[(int)
GD_TOP_BOTTOM] =
"GD_TOP_BOTTOM";
295 enum_map_GraphDirectionEnum[(int)
GD_BOTTOM_TOP] =
"GD_BOTTOM_TOP";
296 enum_map_GraphDirectionEnum[(int)
GD_LEFT_RIGHT] =
"GD_LEFT_RIGHT";
297 enum_map_GraphDirectionEnum[(int)
GD_RIGHT_LEFT] =
"GD_RIGHT_LEFT";
303 data_size =
sizeof(SetGraphMessage_data_t);
306 data = (SetGraphMessage_data_t *)
data_ptr;
308 enum_map_GraphDirectionEnum[(int)
GD_TOP_BOTTOM] =
"GD_TOP_BOTTOM";
309 enum_map_GraphDirectionEnum[(int)
GD_BOTTOM_TOP] =
"GD_BOTTOM_TOP";
310 enum_map_GraphDirectionEnum[(int)
GD_LEFT_RIGHT] =
"GD_LEFT_RIGHT";
311 enum_map_GraphDirectionEnum[(int)
GD_RIGHT_LEFT] =
"GD_RIGHT_LEFT";
329 data = (SetGraphMessage_data_t *)
data_ptr;
343 return data->graph_fsm;
365 strncpy(data->graph_fsm, new_graph_fsm,
sizeof(data->graph_fsm)-1);
366 data->graph_fsm[
sizeof(data->graph_fsm)-1] = 0;
391 data_size =
sizeof(SetGraphDirectionMessage_data_t);
394 data = (SetGraphDirectionMessage_data_t *)
data_ptr;
396 data->graph_dir = ini_graph_dir;
397 enum_map_GraphDirectionEnum[(int)
GD_TOP_BOTTOM] =
"GD_TOP_BOTTOM";
398 enum_map_GraphDirectionEnum[(int)
GD_BOTTOM_TOP] =
"GD_BOTTOM_TOP";
399 enum_map_GraphDirectionEnum[(int)
GD_LEFT_RIGHT] =
"GD_LEFT_RIGHT";
400 enum_map_GraphDirectionEnum[(int)
GD_RIGHT_LEFT] =
"GD_RIGHT_LEFT";
401 add_fieldinfo(
IFT_ENUM,
"graph_dir", 1, &data->graph_dir,
"GraphDirectionEnum", &enum_map_GraphDirectionEnum);
406 data_size =
sizeof(SetGraphDirectionMessage_data_t);
409 data = (SetGraphDirectionMessage_data_t *)
data_ptr;
411 enum_map_GraphDirectionEnum[(int)
GD_TOP_BOTTOM] =
"GD_TOP_BOTTOM";
412 enum_map_GraphDirectionEnum[(int)
GD_BOTTOM_TOP] =
"GD_BOTTOM_TOP";
413 enum_map_GraphDirectionEnum[(int)
GD_LEFT_RIGHT] =
"GD_LEFT_RIGHT";
414 enum_map_GraphDirectionEnum[(int)
GD_RIGHT_LEFT] =
"GD_RIGHT_LEFT";
415 add_fieldinfo(
IFT_ENUM,
"graph_dir", 1, &data->graph_dir,
"GraphDirectionEnum", &enum_map_GraphDirectionEnum);
432 data = (SetGraphDirectionMessage_data_t *)
data_ptr;
468 data->graph_dir = new_graph_dir;
493 data_size =
sizeof(SetGraphColoredMessage_data_t);
496 data = (SetGraphColoredMessage_data_t *)
data_ptr;
498 data->graph_colored = ini_graph_colored;
499 enum_map_GraphDirectionEnum[(int)
GD_TOP_BOTTOM] =
"GD_TOP_BOTTOM";
500 enum_map_GraphDirectionEnum[(int)
GD_BOTTOM_TOP] =
"GD_BOTTOM_TOP";
501 enum_map_GraphDirectionEnum[(int)
GD_LEFT_RIGHT] =
"GD_LEFT_RIGHT";
502 enum_map_GraphDirectionEnum[(int)
GD_RIGHT_LEFT] =
"GD_RIGHT_LEFT";
508 data_size =
sizeof(SetGraphColoredMessage_data_t);
511 data = (SetGraphColoredMessage_data_t *)
data_ptr;
513 enum_map_GraphDirectionEnum[(int)
GD_TOP_BOTTOM] =
"GD_TOP_BOTTOM";
514 enum_map_GraphDirectionEnum[(int)
GD_BOTTOM_TOP] =
"GD_BOTTOM_TOP";
515 enum_map_GraphDirectionEnum[(int)
GD_LEFT_RIGHT] =
"GD_LEFT_RIGHT";
516 enum_map_GraphDirectionEnum[(int)
GD_RIGHT_LEFT] =
"GD_RIGHT_LEFT";
534 data = (SetGraphColoredMessage_data_t *)
data_ptr;
548 return data->graph_colored;
570 data->graph_colored = new_graph_colored;
590 const SetGraphMessage *m0 = dynamic_cast<const SetGraphMessage *>(message);
SkillerDebugInterface Fawkes BlackBoard Interface.
size_t maxlenof_graph_fsm() const
Get maximum length of graph_fsm value.
void * data_ptr
Pointer to memory that contains local data.
Base class for all messages passed through interfaces in Fawkes BlackBoard.
size_t maxlenof_graph_dir() const
Get maximum length of graph_dir value.
Fawkes library namespace.
virtual Message * clone() const
Clone this message.
Timestamp data, must be present and first entries for each interface data structs!...
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.
void set_graph_fsm(const char *new_graph_fsm)
Set graph_fsm value.
size_t maxlenof_graph_colored() const
Get maximum length of graph_colored value.
message_data_ts_t * data_ts
data timestamp aliasing pointer
unsigned int data_size
Size of memory needed to hold all data.
const char * type() const
Get type of interface.
void * data_ptr
Pointer to local memory storage.
virtual Message * clone() const
Clone this message.
GraphDirectionEnum
Primary direction of the graph.
char * graph_fsm() const
Get graph_fsm value.
~SetGraphColoredMessage()
Destructor.
bool is_graph_colored() const
Get graph_colored value.
~SetGraphMessage()
Destructor.
SetGraphColoredMessage Fawkes BlackBoard Interface Message.
SetGraphDirectionMessage()
Constructor.
virtual Message * clone() const
Clone this message.
void set_graph_dir(const GraphDirectionEnum new_graph_dir)
Set graph_dir value.
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.
void add_fieldinfo(interface_fieldtype_t type, const char *name, size_t length, void *value, const char *enumtype=0, const interface_enum_map_t *enum_map=0)
Add an entry to the info list.
SetGraphMessage()
Constructor.
SetGraphDirectionMessage Fawkes BlackBoard Interface Message.
SetGraphColoredMessage()
Constructor.
field with interface specific enum type