Fawkes API  Fawkes Development Version
SkillerDebugInterface.h
1 
2 /***************************************************************************
3  * SkillerDebugInterface.h - Fawkes BlackBoard Interface - SkillerDebugInterface
4  *
5  * Templated created: Thu Oct 12 10:49:19 2006
6  * Copyright 2008 Tim Niemueller
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version. A runtime exception applies to
14  * this software (see LICENSE.GPL_WRE file mentioned below for details).
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_WRE file in the doc directory.
22  */
23 
24 #ifndef __INTERFACES_SKILLERDEBUGINTERFACE_H_
25 #define __INTERFACES_SKILLERDEBUGINTERFACE_H_
26 
27 #include <interface/interface.h>
28 #include <interface/message.h>
29 #include <interface/field_iterator.h>
30 
31 namespace fawkes {
32 
34 {
35  /// @cond INTERNALS
36  INTERFACE_MGMT_FRIENDS(SkillerDebugInterface)
37  /// @endcond
38  public:
39  /* constants */
40 
41  /** Primary direction of the graph. */
42  typedef enum {
43  GD_TOP_BOTTOM /**< From top to bottom. */,
44  GD_BOTTOM_TOP /**< From bottom to top. */,
45  GD_LEFT_RIGHT /**< From left to right. */,
46  GD_RIGHT_LEFT /**< From left to right. */
48  const char * tostring_GraphDirectionEnum(GraphDirectionEnum value) const;
49 
50  private:
51  /** Internal data storage, do NOT modify! */
52  typedef struct __attribute__((packed)) {
53  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
54  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
55  char graph_fsm[32]; /**<
56  The finite state machine (FSM) the current graph has been updated for.
57  */
58  char graph[8192]; /**<
59  The selected graph in a dot string representation.
60  */
61  int32_t graph_dir; /**<
62  Primary direction of current graph.
63  */
64  bool graph_colored; /**<
65  True if the graph is colored, false otherwise.
66  */
67  } SkillerDebugInterface_data_t;
68 
69  SkillerDebugInterface_data_t *data;
70 
71  interface_enum_map_t enum_map_GraphDirectionEnum;
72  public:
73  /* messages */
74  class SetGraphMessage : public Message
75  {
76  private:
77  /** Internal data storage, do NOT modify! */
78  typedef struct __attribute__((packed)) {
79  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
80  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
81  char graph_fsm[32]; /**<
82  The finite state machine (FSM) the current graph has been updated for.
83  */
84  } SetGraphMessage_data_t;
85 
86  SetGraphMessage_data_t *data;
87 
88  interface_enum_map_t enum_map_GraphDirectionEnum;
89  public:
90  SetGraphMessage(const char * ini_graph_fsm);
92  ~SetGraphMessage();
93 
95  /* Methods */
96  char * graph_fsm() const;
97  void set_graph_fsm(const char * new_graph_fsm);
98  size_t maxlenof_graph_fsm() const;
99  virtual Message * clone() const;
100  };
101 
103  {
104  private:
105  /** Internal data storage, do NOT modify! */
106  typedef struct __attribute__((packed)) {
107  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
108  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
109  int32_t graph_dir; /**<
110  Primary direction of current graph.
111  */
112  } SetGraphDirectionMessage_data_t;
113 
114  SetGraphDirectionMessage_data_t *data;
115 
116  interface_enum_map_t enum_map_GraphDirectionEnum;
117  public:
118  SetGraphDirectionMessage(const GraphDirectionEnum ini_graph_dir);
121 
123  /* Methods */
124  GraphDirectionEnum graph_dir() const;
125  void set_graph_dir(const GraphDirectionEnum new_graph_dir);
126  size_t maxlenof_graph_dir() const;
127  virtual Message * clone() const;
128  };
129 
131  {
132  private:
133  /** Internal data storage, do NOT modify! */
134  typedef struct __attribute__((packed)) {
135  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
136  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
137  bool graph_colored; /**<
138  True if the graph is colored, false otherwise.
139  */
140  } SetGraphColoredMessage_data_t;
141 
142  SetGraphColoredMessage_data_t *data;
143 
144  interface_enum_map_t enum_map_GraphDirectionEnum;
145  public:
146  SetGraphColoredMessage(const bool ini_graph_colored);
149 
151  /* Methods */
152  bool is_graph_colored() const;
153  void set_graph_colored(const bool new_graph_colored);
154  size_t maxlenof_graph_colored() const;
155  virtual Message * clone() const;
156  };
157 
158  virtual bool message_valid(const Message *message) const;
159  private:
162 
163  public:
164  /* Methods */
165  char * graph_fsm() const;
166  void set_graph_fsm(const char * new_graph_fsm);
167  size_t maxlenof_graph_fsm() const;
168  char * graph() const;
169  void set_graph(const char * new_graph);
170  size_t maxlenof_graph() const;
171  GraphDirectionEnum graph_dir() const;
172  void set_graph_dir(const GraphDirectionEnum new_graph_dir);
173  size_t maxlenof_graph_dir() const;
174  bool is_graph_colored() const;
175  void set_graph_colored(const bool new_graph_colored);
176  size_t maxlenof_graph_colored() const;
177  virtual Message * create_message(const char *type) const;
178 
179  virtual void copy_values(const Interface *other);
180  virtual const char * enum_tostring(const char *enumtype, int val) const;
181 
182 };
183 
184 } // end namespace fawkes
185 
186 #endif
void set_graph(const char *new_graph)
Set graph value.
SkillerDebugInterface Fawkes BlackBoard Interface.
Base class for all messages passed through interfaces in Fawkes BlackBoard.
Definition: message.h:44
Fawkes library namespace.
size_t maxlenof_graph() const
Get maximum length of graph value.
SetGraphMessage Fawkes BlackBoard Interface Message.
size_t maxlenof_graph_colored() const
Get maximum length of graph_colored value.
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:79
size_t maxlenof_graph_fsm() const
Get maximum length of graph_fsm value.
GraphDirectionEnum graph_dir() const
Get graph_dir value.
const char * type() const
Get type of interface.
Definition: interface.cpp:651
void set_graph_colored(const bool new_graph_colored)
Set graph_colored value.
GraphDirectionEnum
Primary direction of the graph.
void set_graph_fsm(const char *new_graph_fsm)
Set graph_fsm value.
SetGraphColoredMessage Fawkes BlackBoard Interface Message.
const char * tostring_GraphDirectionEnum(GraphDirectionEnum value) const
Convert GraphDirectionEnum constant to string.
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.
bool is_graph_colored() const
Get graph_colored value.
char * graph() const
Get graph value.
size_t maxlenof_graph_dir() const
Get maximum length of graph_dir value.
char * graph_fsm() const
Get graph_fsm value.
void set_graph_dir(const GraphDirectionEnum new_graph_dir)
Set graph_dir value.
SetGraphDirectionMessage Fawkes BlackBoard Interface Message.
std::map< int, std::string > interface_enum_map_t
Map of enum integer to string values.
Definition: types.h:53
virtual void copy_values(const Interface *other)
Copy values from other interface.
virtual const char * enum_tostring(const char *enumtype, int val) const
Convert arbitrary enum value to string.
virtual Message * create_message(const char *type) const
Create message based on type name.