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 uint64_t test_ulint; /**< Test unsigned long int */ 00063 int64_t test_lint; /**< Test long int */ 00064 } TestInterface_data_t; 00065 #pragma pack(pop) 00066 00067 TestInterface_data_t *data; 00068 00069 public: 00070 /* messages */ 00071 class SetTestIntMessage : public Message 00072 { 00073 private: 00074 #pragma pack(push,4) 00075 /** Internal data storage, do NOT modify! */ 00076 typedef struct { 00077 int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */ 00078 int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */ 00079 int32_t test_int; /**< Test integer */ 00080 } SetTestIntMessage_data_t; 00081 #pragma pack(pop) 00082 00083 SetTestIntMessage_data_t *data; 00084 00085 public: 00086 SetTestIntMessage(const int32_t ini_test_int); 00087 SetTestIntMessage(); 00088 ~SetTestIntMessage(); 00089 00090 SetTestIntMessage(const SetTestIntMessage *m); 00091 /* Methods */ 00092 int32_t test_int() const; 00093 void set_test_int(const int32_t new_test_int); 00094 size_t maxlenof_test_int() const; 00095 virtual Message * clone() const; 00096 }; 00097 00098 class SetTestStringMessage : public Message 00099 { 00100 private: 00101 #pragma pack(push,4) 00102 /** Internal data storage, do NOT modify! */ 00103 typedef struct { 00104 int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */ 00105 int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */ 00106 char test_string[30]; /**< A test sring */ 00107 } SetTestStringMessage_data_t; 00108 #pragma pack(pop) 00109 00110 SetTestStringMessage_data_t *data; 00111 00112 public: 00113 SetTestStringMessage(const char * ini_test_string); 00114 SetTestStringMessage(); 00115 ~SetTestStringMessage(); 00116 00117 SetTestStringMessage(const SetTestStringMessage *m); 00118 /* Methods */ 00119 char * test_string() const; 00120 void set_test_string(const char * new_test_string); 00121 size_t maxlenof_test_string() const; 00122 virtual Message * clone() const; 00123 }; 00124 00125 class CalculateMessage : public Message 00126 { 00127 private: 00128 #pragma pack(push,4) 00129 /** Internal data storage, do NOT modify! */ 00130 typedef struct { 00131 int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */ 00132 int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */ 00133 int32_t summand; /**< Summand */ 00134 int32_t addend; /**< Addend */ 00135 } CalculateMessage_data_t; 00136 #pragma pack(pop) 00137 00138 CalculateMessage_data_t *data; 00139 00140 public: 00141 CalculateMessage(const int32_t ini_summand, const int32_t ini_addend); 00142 CalculateMessage(); 00143 ~CalculateMessage(); 00144 00145 CalculateMessage(const CalculateMessage *m); 00146 /* Methods */ 00147 int32_t summand() const; 00148 void set_summand(const int32_t new_summand); 00149 size_t maxlenof_summand() const; 00150 int32_t addend() const; 00151 void set_addend(const int32_t new_addend); 00152 size_t maxlenof_addend() const; 00153 virtual Message * clone() const; 00154 }; 00155 00156 virtual bool message_valid(const Message *message) const; 00157 private: 00158 TestInterface(); 00159 ~TestInterface(); 00160 00161 public: 00162 /* Methods */ 00163 bool is_test_bool() const; 00164 void set_test_bool(const bool new_test_bool); 00165 size_t maxlenof_test_bool() const; 00166 int32_t test_int() const; 00167 void set_test_int(const int32_t new_test_int); 00168 size_t maxlenof_test_int() const; 00169 uint8_t flags() const; 00170 void set_flags(const uint8_t new_flags); 00171 size_t maxlenof_flags() const; 00172 char * test_string() const; 00173 void set_test_string(const char * new_test_string); 00174 size_t maxlenof_test_string() const; 00175 int32_t result() const; 00176 void set_result(const int32_t new_result); 00177 size_t maxlenof_result() const; 00178 uint32_t test_uint() const; 00179 void set_test_uint(const uint32_t new_test_uint); 00180 size_t maxlenof_test_uint() const; 00181 uint64_t test_ulint() const; 00182 void set_test_ulint(const uint64_t new_test_ulint); 00183 size_t maxlenof_test_ulint() const; 00184 int64_t test_lint() const; 00185 void set_test_lint(const int64_t new_test_lint); 00186 size_t maxlenof_test_lint() const; 00187 virtual Message * create_message(const char *type) const; 00188 00189 virtual void copy_values(const Interface *other); 00190 virtual const char * enum_tostring(const char *enumtype, int val) const; 00191 00192 }; 00193 00194 } // end namespace fawkes 00195 00196 #endif