TestInterface.h

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 int 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
00049  private:
00050   /** Internal data storage, do NOT modify! */
00051   typedef struct {
00052     unsigned int test_uint; /**< Test unsigned int */
00053     int test_int; /**< Test integer */
00054     int result; /**< Result of operation add operation from Calculate message. */
00055     unsigned long int test_ulint; /**< Test unsigned long int */
00056     long int test_lint; /**< Test long int */
00057     bool test_bool; /**< Test Bool */
00058     unsigned char flags; /**< Flags spit down by the writer */
00059     char test_string[30]; /**< A test sring */
00060   } TestInterface_data_t;
00061
00062   TestInterface_data_t *data;
00063
00064  public:
00065   /* messages */
00066   class SetTestIntMessage : public Message
00067   {
00068    private:
00069     /** Internal data storage, do NOT modify! */
00070     typedef struct {
00071       int test_int; /**< Test integer */
00072     } SetTestIntMessage_data_t;
00073
00074     SetTestIntMessage_data_t *data;
00075
00076    public:
00077     SetTestIntMessage(const int ini_test_int);
00078     SetTestIntMessage();
00079     ~SetTestIntMessage();
00080
00081     SetTestIntMessage(const SetTestIntMessage *m);
00082     /* Methods */
00083     int test_int() const;
00084     void set_test_int(const int new_test_int);
00085     size_t maxlenof_test_int() const;
00086     virtual Message * clone() const;
00087   };
00088
00089   class SetTestStringMessage : public Message
00090   {
00091    private:
00092     /** Internal data storage, do NOT modify! */
00093     typedef struct {
00094       char test_string[30]; /**< A test sring */
00095     } SetTestStringMessage_data_t;
00096
00097     SetTestStringMessage_data_t *data;
00098
00099    public:
00100     SetTestStringMessage(const char * ini_test_string);
00101     SetTestStringMessage();
00102     ~SetTestStringMessage();
00103
00104     SetTestStringMessage(const SetTestStringMessage *m);
00105     /* Methods */
00106     char * test_string() const;
00107     void set_test_string(const char * new_test_string);
00108     size_t maxlenof_test_string() const;
00109     virtual Message * clone() const;
00110   };
00111
00112   class CalculateMessage : public Message
00113   {
00114    private:
00115     /** Internal data storage, do NOT modify! */
00116     typedef struct {
00117       int summand; /**< Summand */
00118       int addend; /**< Addend */
00119     } CalculateMessage_data_t;
00120
00121     CalculateMessage_data_t *data;
00122
00123    public:
00124     CalculateMessage(const int ini_summand, const int ini_addend);
00125     CalculateMessage();
00126     ~CalculateMessage();
00127
00128     CalculateMessage(const CalculateMessage *m);
00129     /* Methods */
00130     int summand() const;
00131     void set_summand(const int new_summand);
00132     size_t maxlenof_summand() const;
00133     int addend() const;
00134     void set_addend(const int new_addend);
00135     size_t maxlenof_addend() const;
00136     virtual Message * clone() const;
00137   };
00138
00139   virtual bool message_valid(const Message *message) const;
00140  private:
00141   TestInterface();
00142   ~TestInterface();
00143
00144  public:
00145   /* Methods */
00146   bool is_test_bool() const;
00147   void set_test_bool(const bool new_test_bool);
00148   size_t maxlenof_test_bool() const;
00149   int test_int() const;
00150   void set_test_int(const int new_test_int);
00151   size_t maxlenof_test_int() const;
00152   unsigned char flags() const;
00153   void set_flags(const unsigned char new_flags);
00154   size_t maxlenof_flags() const;
00155   char * test_string() const;
00156   void set_test_string(const char * new_test_string);
00157   size_t maxlenof_test_string() const;
00158   int result() const;
00159   void set_result(const int new_result);
00160   size_t maxlenof_result() const;
00161   unsigned int test_uint() const;
00162   void set_test_uint(const unsigned int new_test_uint);
00163   size_t maxlenof_test_uint() const;
00164   unsigned long int test_ulint() const;
00165   void set_test_ulint(const unsigned long int new_test_ulint);
00166   size_t maxlenof_test_ulint() const;
00167   long int test_lint() const;
00168   void set_test_lint(const long int new_test_lint);
00169   size_t maxlenof_test_lint() const;
00170   virtual Message * create_message(const char *type) const;
00171
00172   virtual void copy_values(const Interface *other);
00173
00174 };
00175
00176 } // end namespace fawkes
00177
00178 #endif