Fawkes API Fawkes Development Version
TestInterface.h
1
2/***************************************************************************
3 * TestInterface.h - Fawkes BlackBoard Interface - TestInterface
4 *
5 * Templated created: Thu Oct 12 10:49:19 2006
6 * Copyright 2006-2007 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_TESTINTERFACE_H_
25#define _INTERFACES_TESTINTERFACE_H_
26
27#include <interface/interface.h>
28#include <interface/message.h>
29#include <interface/field_iterator.h>
30
31namespace fawkes {
32
34{
35 /// @cond INTERNALS
36 INTERFACE_MGMT_FRIENDS(TestInterface)
37 /// @endcond
38 public:
39 /* constants */
40 static const int32_t TEST_CONSTANT;
41 static const float TEST_FLOAT_CONSTANT;
42
43 /** Demonstrating enums */
44 typedef enum {
45 TEST_ENUM_1 /**< Item 1 */,
46 TEST_ENUM_2 /**< Item 2 */
48 const char * tostring_TestEnum(TestEnum value) const;
49
50 private:
51 /** Internal data storage, do NOT modify! */
52 typedef struct {
53 int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
54 int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
55 bool test_bool; /**< Test Bool */
56 int32_t test_int; /**< Test integer */
57 uint8_t flags; /**< Flags spit down by the writer */
58 char test_string[30]; /**< A test sring */
59 int32_t result; /**< Result of operation add operation from Calculate message. */
60 uint32_t test_uint; /**< Test uint32 */
61 } TestInterface_data_t;
62
63 TestInterface_data_t *data;
64
65 interface_enum_map_t enum_map_TestEnum;
66 public:
67 /* messages */
69 {
70 private:
71 /** Internal data storage, do NOT modify! */
72 typedef struct {
73 int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
74 int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
75 int32_t test_int; /**< Test integer */
76 } SetTestIntMessage_data_t;
77
78 SetTestIntMessage_data_t *data;
79
80 interface_enum_map_t enum_map_TestEnum;
81 public:
82 SetTestIntMessage(const int32_t ini_test_int);
85
86 explicit SetTestIntMessage(const SetTestIntMessage *m);
87 /* Methods */
88 int32_t test_int() const;
89 void set_test_int(const int32_t new_test_int);
90 size_t maxlenof_test_int() const;
91 virtual Message * clone() const;
92 };
93
95 {
96 private:
97 /** Internal data storage, do NOT modify! */
98 typedef struct {
99 int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
100 int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
101 char test_string[30]; /**< A test sring */
102 } SetTestStringMessage_data_t;
103
104 SetTestStringMessage_data_t *data;
105
106 interface_enum_map_t enum_map_TestEnum;
107 public:
108 SetTestStringMessage(const char * ini_test_string);
111
113 /* Methods */
114 char * test_string() const;
115 void set_test_string(const char * new_test_string);
116 size_t maxlenof_test_string() const;
117 virtual Message * clone() const;
118 };
119
121 {
122 private:
123 /** Internal data storage, do NOT modify! */
124 typedef struct {
125 int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
126 int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
127 int32_t summand; /**< Summand */
128 int32_t addend; /**< Addend */
129 } CalculateMessage_data_t;
130
131 CalculateMessage_data_t *data;
132
133 interface_enum_map_t enum_map_TestEnum;
134 public:
135 CalculateMessage(const int32_t ini_summand, const int32_t ini_addend);
138
139 explicit CalculateMessage(const CalculateMessage *m);
140 /* Methods */
141 int32_t summand() const;
142 void set_summand(const int32_t new_summand);
143 size_t maxlenof_summand() const;
144 int32_t addend() const;
145 void set_addend(const int32_t new_addend);
146 size_t maxlenof_addend() const;
147 virtual Message * clone() const;
148 };
149
150 virtual bool message_valid(const Message *message) const;
151 private:
154
155 public:
156 /* Methods */
157 bool is_test_bool() const;
158 void set_test_bool(const bool new_test_bool);
159 size_t maxlenof_test_bool() const;
160 int32_t test_int() const;
161 void set_test_int(const int32_t new_test_int);
162 size_t maxlenof_test_int() const;
163 uint8_t flags() const;
164 void set_flags(const uint8_t new_flags);
165 size_t maxlenof_flags() const;
166 char * test_string() const;
167 void set_test_string(const char * new_test_string);
168 size_t maxlenof_test_string() const;
169 int32_t result() const;
170 void set_result(const int32_t new_result);
171 size_t maxlenof_result() const;
172 uint32_t test_uint() const;
173 void set_test_uint(const uint32_t new_test_uint);
174 size_t maxlenof_test_uint() const;
175 virtual Message * create_message(const char *type) const;
176
177 virtual void copy_values(const Interface *other);
178 virtual const char * enum_tostring(const char *enumtype, int val) const;
179
180};
181
182} // end namespace fawkes
183
184#endif
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:80
const char * type() const
Get type of interface.
Definition: interface.cpp:652
Base class for all messages passed through interfaces in Fawkes BlackBoard.
Definition: message.h:44
CalculateMessage Fawkes BlackBoard Interface Message.
int32_t summand() const
Get summand value.
void set_addend(const int32_t new_addend)
Set addend value.
size_t maxlenof_addend() const
Get maximum length of addend value.
void set_summand(const int32_t new_summand)
Set summand value.
size_t maxlenof_summand() const
Get maximum length of summand value.
int32_t addend() const
Get addend value.
virtual Message * clone() const
Clone this message.
SetTestIntMessage Fawkes BlackBoard Interface Message.
Definition: TestInterface.h:69
size_t maxlenof_test_int() const
Get maximum length of test_int value.
virtual Message * clone() const
Clone this message.
int32_t test_int() const
Get test_int value.
void set_test_int(const int32_t new_test_int)
Set test_int value.
SetTestStringMessage Fawkes BlackBoard Interface Message.
Definition: TestInterface.h:95
void set_test_string(const char *new_test_string)
Set test_string value.
virtual Message * clone() const
Clone this message.
char * test_string() const
Get test_string value.
size_t maxlenof_test_string() const
Get maximum length of test_string value.
TestInterface Fawkes BlackBoard Interface.
Definition: TestInterface.h:34
bool is_test_bool() const
Get test_bool value.
uint8_t flags() const
Get flags value.
virtual void copy_values(const Interface *other)
Copy values from other interface.
void set_test_string(const char *new_test_string)
Set test_string value.
size_t maxlenof_test_bool() const
Get maximum length of test_bool value.
size_t maxlenof_result() const
Get maximum length of result value.
void set_test_uint(const uint32_t new_test_uint)
Set test_uint value.
uint32_t test_uint() const
Get test_uint value.
void set_test_int(const int32_t new_test_int)
Set test_int value.
static const float TEST_FLOAT_CONSTANT
TEST_FLOAT_CONSTANT constant.
Definition: TestInterface.h:41
size_t maxlenof_test_int() const
Get maximum length of test_int value.
const char * tostring_TestEnum(TestEnum value) const
Convert TestEnum constant to string.
void set_test_bool(const bool new_test_bool)
Set test_bool value.
char * test_string() const
Get test_string value.
size_t maxlenof_test_uint() const
Get maximum length of test_uint value.
virtual Message * create_message(const char *type) const
Create message based on type name.
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.
virtual const char * enum_tostring(const char *enumtype, int val) const
Convert arbitrary enum value to string.
size_t maxlenof_flags() const
Get maximum length of flags value.
int32_t result() const
Get result value.
int32_t test_int() const
Get test_int value.
static const int32_t TEST_CONSTANT
TEST_CONSTANT constant.
Definition: TestInterface.h:40
size_t maxlenof_test_string() const
Get maximum length of test_string value.
void set_flags(const uint8_t new_flags)
Set flags value.
void set_result(const int32_t new_result)
Set result value.
TestEnum
Demonstrating enums.
Definition: TestInterface.h:44
Fawkes library namespace.
std::map< int, std::string > interface_enum_map_t
Map of enum integer to string values.
Definition: types.h:54