Fawkes API
Fawkes Development Version
|
00001 00002 /*************************************************************************** 00003 * TestInterface.h - Fawkes BlackBoard Interface - TestInterface 00004 * 00005 * Templated created: Thu Oct 12 10:49:19 2006 00006 * Copyright 2006-2007 Tim Niemueller 00007 * 00008 ****************************************************************************/ 00009 00010 /* This program is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. A runtime exception applies to 00014 * this software (see LICENSE.GPL_WRE file mentioned below for details). 00015 * 00016 * This program is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU Library General Public License for more details. 00020 * 00021 * Read the full text in the LICENSE.GPL_WRE file in the doc directory. 00022 */ 00023 00024 #ifndef __INTERFACES_TESTINTERFACE_H_ 00025 #define __INTERFACES_TESTINTERFACE_H_ 00026 00027 #include <interface/interface.h> 00028 #include <interface/message.h> 00029 #include <interface/field_iterator.h> 00030 00031 namespace fawkes { 00032 00033 class TestInterface : public Interface 00034 { 00035 /// @cond INTERNALS 00036 INTERFACE_MGMT_FRIENDS(TestInterface) 00037 /// @endcond 00038 public: 00039 /* constants */ 00040 static const int32_t TEST_CONSTANT; 00041 static const float TEST_FLOAT_CONSTANT; 00042 00043 /** Demonstrating enums */ 00044 typedef enum { 00045 TEST_ENUM_1 /**< Item 1 */, 00046 TEST_ENUM_2 /**< Item 2 */ 00047 } TestEnum; 00048 const char * tostring_TestEnum(TestEnum value) const; 00049 00050 private: 00051 #pragma pack(push,4) 00052 /** Internal data storage, do NOT modify! */ 00053 typedef struct { 00054 int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */ 00055 int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */ 00056 bool test_bool; /**< Test Bool */ 00057 int32_t test_int; /**< Test integer */ 00058 uint8_t flags; /**< Flags spit down by the writer */ 00059 char test_string[30]; /**< A test sring */ 00060 int32_t result; /**< Result of operation add operation from Calculate message. */ 00061 uint32_t test_uint; /**< Test uint32 */ 00062 } TestInterface_data_t; 00063 #pragma pack(pop) 00064 00065 TestInterface_data_t *data; 00066 00067 public: 00068 /* messages */ 00069 class SetTestIntMessage : public Message 00070 { 00071 private: 00072 #pragma pack(push,4) 00073 /** Internal data storage, do NOT modify! */ 00074 typedef struct { 00075 int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */ 00076 int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */ 00077 int32_t test_int; /**< Test integer */ 00078 } SetTestIntMessage_data_t; 00079 #pragma pack(pop) 00080 00081 SetTestIntMessage_data_t *data; 00082 00083 public: 00084 SetTestIntMessage(const int32_t ini_test_int); 00085 SetTestIntMessage(); 00086 ~SetTestIntMessage(); 00087 00088 SetTestIntMessage(const SetTestIntMessage *m); 00089 /* Methods */ 00090 int32_t test_int() const; 00091 void set_test_int(const int32_t new_test_int); 00092 size_t maxlenof_test_int() const; 00093 virtual Message * clone() const; 00094 }; 00095 00096 class SetTestStringMessage : public Message 00097 { 00098 private: 00099 #pragma pack(push,4) 00100 /** Internal data storage, do NOT modify! */ 00101 typedef struct { 00102 int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */ 00103 int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */ 00104 char test_string[30]; /**< A test sring */ 00105 } SetTestStringMessage_data_t; 00106 #pragma pack(pop) 00107 00108 SetTestStringMessage_data_t *data; 00109 00110 public: 00111 SetTestStringMessage(const char * ini_test_string); 00112 SetTestStringMessage(); 00113 ~SetTestStringMessage(); 00114 00115 SetTestStringMessage(const SetTestStringMessage *m); 00116 /* Methods */ 00117 char * test_string() const; 00118 void set_test_string(const char * new_test_string); 00119 size_t maxlenof_test_string() const; 00120 virtual Message * clone() const; 00121 }; 00122 00123 class CalculateMessage : public Message 00124 { 00125 private: 00126 #pragma pack(push,4) 00127 /** Internal data storage, do NOT modify! */ 00128 typedef struct { 00129 int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */ 00130 int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */ 00131 int32_t summand; /**< Summand */ 00132 int32_t addend; /**< Addend */ 00133 } CalculateMessage_data_t; 00134 #pragma pack(pop) 00135 00136 CalculateMessage_data_t *data; 00137 00138 public: 00139 CalculateMessage(const int32_t ini_summand, const int32_t ini_addend); 00140 CalculateMessage(); 00141 ~CalculateMessage(); 00142 00143 CalculateMessage(const CalculateMessage *m); 00144 /* Methods */ 00145 int32_t summand() const; 00146 void set_summand(const int32_t new_summand); 00147 size_t maxlenof_summand() const; 00148 int32_t addend() const; 00149 void set_addend(const int32_t new_addend); 00150 size_t maxlenof_addend() const; 00151 virtual Message * clone() const; 00152 }; 00153 00154 virtual bool message_valid(const Message *message) const; 00155 private: 00156 TestInterface(); 00157 ~TestInterface(); 00158 00159 public: 00160 /* Methods */ 00161 bool is_test_bool() const; 00162 void set_test_bool(const bool new_test_bool); 00163 size_t maxlenof_test_bool() const; 00164 int32_t test_int() const; 00165 void set_test_int(const int32_t new_test_int); 00166 size_t maxlenof_test_int() const; 00167 uint8_t flags() const; 00168 void set_flags(const uint8_t new_flags); 00169 size_t maxlenof_flags() const; 00170 char * test_string() const; 00171 void set_test_string(const char * new_test_string); 00172 size_t maxlenof_test_string() const; 00173 int32_t result() const; 00174 void set_result(const int32_t new_result); 00175 size_t maxlenof_result() const; 00176 uint32_t test_uint() const; 00177 void set_test_uint(const uint32_t new_test_uint); 00178 size_t maxlenof_test_uint() const; 00179 virtual Message * create_message(const char *type) const; 00180 00181 virtual void copy_values(const Interface *other); 00182 virtual const char * enum_tostring(const char *enumtype, int val) const; 00183 00184 }; 00185 00186 } // end namespace fawkes 00187 00188 #endif