Fawkes API  Fawkes Development Version
OpenRaveInterface.h
00001 
00002 /***************************************************************************
00003  *  OpenRaveInterface.h - Fawkes BlackBoard Interface - OpenRaveInterface
00004  *
00005  *  Templated created:   Thu Oct 12 10:49:19 2006
00006  *  Copyright  2011  Bahram Maleki-Fard
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_OPENRAVEINTERFACE_H_
00025 #define __INTERFACES_OPENRAVEINTERFACE_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 OpenRaveInterface : public Interface
00034 {
00035  /// @cond INTERNALS
00036  INTERFACE_MGMT_FRIENDS(OpenRaveInterface)
00037  /// @endcond
00038  public:
00039   /* constants */
00040 
00041  private:
00042 #pragma pack(push,4)
00043   /** Internal data storage, do NOT modify! */
00044   typedef struct {
00045     int64_t timestamp_sec;  /**< Interface Unix timestamp, seconds */
00046     int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
00047     uint32_t msgid; /**< The ID of the message that is currently being
00048       processed, or 0 if no message is being processed. */
00049     bool final; /**< True, if the last goto command has been finished,
00050       false if it is still running */
00051     uint32_t error_code; /**< Failure code set if
00052       final is true. 0 if no error occured, an error code from ERROR_*
00053       constants otherwise (or a bit-wise combination). */
00054     bool success; /**< True, if last command was successful. False otherwise */
00055   } OpenRaveInterface_data_t;
00056 #pragma pack(pop)
00057 
00058   OpenRaveInterface_data_t *data;
00059 
00060  public:
00061   /* messages */
00062   class AddObjectMessage : public Message
00063   {
00064    private:
00065 #pragma pack(push,4)
00066     /** Internal data storage, do NOT modify! */
00067     typedef struct {
00068       int64_t timestamp_sec;  /**< Interface Unix timestamp, seconds */
00069       int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
00070       char name[30]; /**< Name of object */
00071       char path[1024]; /**< Path to object xml file */
00072     } AddObjectMessage_data_t;
00073 #pragma pack(pop)
00074 
00075     AddObjectMessage_data_t *data;
00076 
00077    public:
00078     AddObjectMessage(const char * ini_name, const char * ini_path);
00079     AddObjectMessage();
00080     ~AddObjectMessage();
00081 
00082     AddObjectMessage(const AddObjectMessage *m);
00083     /* Methods */
00084     char * name() const;
00085     void set_name(const char * new_name);
00086     size_t maxlenof_name() const;
00087     char * path() const;
00088     void set_path(const char * new_path);
00089     size_t maxlenof_path() const;
00090     virtual Message * clone() const;
00091   };
00092 
00093   class DeleteObjectMessage : public Message
00094   {
00095    private:
00096 #pragma pack(push,4)
00097     /** Internal data storage, do NOT modify! */
00098     typedef struct {
00099       int64_t timestamp_sec;  /**< Interface Unix timestamp, seconds */
00100       int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
00101       char name[30]; /**< Name of object */
00102     } DeleteObjectMessage_data_t;
00103 #pragma pack(pop)
00104 
00105     DeleteObjectMessage_data_t *data;
00106 
00107    public:
00108     DeleteObjectMessage(const char * ini_name);
00109     DeleteObjectMessage();
00110     ~DeleteObjectMessage();
00111 
00112     DeleteObjectMessage(const DeleteObjectMessage *m);
00113     /* Methods */
00114     char * name() const;
00115     void set_name(const char * new_name);
00116     size_t maxlenof_name() const;
00117     virtual Message * clone() const;
00118   };
00119 
00120   class AttachObjectMessage : public Message
00121   {
00122    private:
00123 #pragma pack(push,4)
00124     /** Internal data storage, do NOT modify! */
00125     typedef struct {
00126       int64_t timestamp_sec;  /**< Interface Unix timestamp, seconds */
00127       int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
00128       char name[30]; /**< Name of object */
00129     } AttachObjectMessage_data_t;
00130 #pragma pack(pop)
00131 
00132     AttachObjectMessage_data_t *data;
00133 
00134    public:
00135     AttachObjectMessage(const char * ini_name);
00136     AttachObjectMessage();
00137     ~AttachObjectMessage();
00138 
00139     AttachObjectMessage(const AttachObjectMessage *m);
00140     /* Methods */
00141     char * name() const;
00142     void set_name(const char * new_name);
00143     size_t maxlenof_name() const;
00144     virtual Message * clone() const;
00145   };
00146 
00147   class ReleaseObjectMessage : public Message
00148   {
00149    private:
00150 #pragma pack(push,4)
00151     /** Internal data storage, do NOT modify! */
00152     typedef struct {
00153       int64_t timestamp_sec;  /**< Interface Unix timestamp, seconds */
00154       int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
00155       char name[30]; /**< Name of object */
00156     } ReleaseObjectMessage_data_t;
00157 #pragma pack(pop)
00158 
00159     ReleaseObjectMessage_data_t *data;
00160 
00161    public:
00162     ReleaseObjectMessage(const char * ini_name);
00163     ReleaseObjectMessage();
00164     ~ReleaseObjectMessage();
00165 
00166     ReleaseObjectMessage(const ReleaseObjectMessage *m);
00167     /* Methods */
00168     char * name() const;
00169     void set_name(const char * new_name);
00170     size_t maxlenof_name() const;
00171     virtual Message * clone() const;
00172   };
00173 
00174   class ReleaseAllObjectsMessage : public Message
00175   {
00176    private:
00177 #pragma pack(push,4)
00178     /** Internal data storage, do NOT modify! */
00179     typedef struct {
00180       int64_t timestamp_sec;  /**< Interface Unix timestamp, seconds */
00181       int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
00182     } ReleaseAllObjectsMessage_data_t;
00183 #pragma pack(pop)
00184 
00185     ReleaseAllObjectsMessage_data_t *data;
00186 
00187    public:
00188     ReleaseAllObjectsMessage();
00189     ~ReleaseAllObjectsMessage();
00190 
00191     ReleaseAllObjectsMessage(const ReleaseAllObjectsMessage *m);
00192     /* Methods */
00193     virtual Message * clone() const;
00194   };
00195 
00196   class MoveObjectMessage : public Message
00197   {
00198    private:
00199 #pragma pack(push,4)
00200     /** Internal data storage, do NOT modify! */
00201     typedef struct {
00202       int64_t timestamp_sec;  /**< Interface Unix timestamp, seconds */
00203       int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
00204       char name[30]; /**< Name of object */
00205       float x; /**< x position of object (meters) */
00206       float y; /**< y position of object (meters) */
00207       float z; /**< z position of object (meters) */
00208     } MoveObjectMessage_data_t;
00209 #pragma pack(pop)
00210 
00211     MoveObjectMessage_data_t *data;
00212 
00213    public:
00214     MoveObjectMessage(const char * ini_name, const float ini_x, const float ini_y, const float ini_z);
00215     MoveObjectMessage();
00216     ~MoveObjectMessage();
00217 
00218     MoveObjectMessage(const MoveObjectMessage *m);
00219     /* Methods */
00220     char * name() const;
00221     void set_name(const char * new_name);
00222     size_t maxlenof_name() const;
00223     float x() const;
00224     void set_x(const float new_x);
00225     size_t maxlenof_x() const;
00226     float y() const;
00227     void set_y(const float new_y);
00228     size_t maxlenof_y() const;
00229     float z() const;
00230     void set_z(const float new_z);
00231     size_t maxlenof_z() const;
00232     virtual Message * clone() const;
00233   };
00234 
00235   class RotateObjectQuatMessage : public Message
00236   {
00237    private:
00238 #pragma pack(push,4)
00239     /** Internal data storage, do NOT modify! */
00240     typedef struct {
00241       int64_t timestamp_sec;  /**< Interface Unix timestamp, seconds */
00242       int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
00243       char name[30]; /**< Name of object */
00244       float x; /**< x value of quaternion */
00245       float y; /**< y value of quaternion */
00246       float z; /**< z value of quaternion */
00247       float w; /**< w value of quaternion */
00248     } RotateObjectQuatMessage_data_t;
00249 #pragma pack(pop)
00250 
00251     RotateObjectQuatMessage_data_t *data;
00252 
00253    public:
00254     RotateObjectQuatMessage(const char * ini_name, const float ini_x, const float ini_y, const float ini_z, const float ini_w);
00255     RotateObjectQuatMessage();
00256     ~RotateObjectQuatMessage();
00257 
00258     RotateObjectQuatMessage(const RotateObjectQuatMessage *m);
00259     /* Methods */
00260     char * name() const;
00261     void set_name(const char * new_name);
00262     size_t maxlenof_name() const;
00263     float x() const;
00264     void set_x(const float new_x);
00265     size_t maxlenof_x() const;
00266     float y() const;
00267     void set_y(const float new_y);
00268     size_t maxlenof_y() const;
00269     float z() const;
00270     void set_z(const float new_z);
00271     size_t maxlenof_z() const;
00272     float w() const;
00273     void set_w(const float new_w);
00274     size_t maxlenof_w() const;
00275     virtual Message * clone() const;
00276   };
00277 
00278   class RotateObjectMessage : public Message
00279   {
00280    private:
00281 #pragma pack(push,4)
00282     /** Internal data storage, do NOT modify! */
00283     typedef struct {
00284       int64_t timestamp_sec;  /**< Interface Unix timestamp, seconds */
00285       int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
00286       char name[30]; /**< Name of object */
00287       float x; /**< x-axis rotation of object (rad) */
00288       float y; /**< y-axis rotation of object (rad) */
00289       float z; /**< z-axis rotation of object (rad) */
00290     } RotateObjectMessage_data_t;
00291 #pragma pack(pop)
00292 
00293     RotateObjectMessage_data_t *data;
00294 
00295    public:
00296     RotateObjectMessage(const char * ini_name, const float ini_x, const float ini_y, const float ini_z);
00297     RotateObjectMessage();
00298     ~RotateObjectMessage();
00299 
00300     RotateObjectMessage(const RotateObjectMessage *m);
00301     /* Methods */
00302     char * name() const;
00303     void set_name(const char * new_name);
00304     size_t maxlenof_name() const;
00305     float x() const;
00306     void set_x(const float new_x);
00307     size_t maxlenof_x() const;
00308     float y() const;
00309     void set_y(const float new_y);
00310     size_t maxlenof_y() const;
00311     float z() const;
00312     void set_z(const float new_z);
00313     size_t maxlenof_z() const;
00314     virtual Message * clone() const;
00315   };
00316 
00317   class RenameObjectMessage : public Message
00318   {
00319    private:
00320 #pragma pack(push,4)
00321     /** Internal data storage, do NOT modify! */
00322     typedef struct {
00323       int64_t timestamp_sec;  /**< Interface Unix timestamp, seconds */
00324       int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
00325       char name[30]; /**< Name of object */
00326       char newName[30]; /**< New name of object */
00327     } RenameObjectMessage_data_t;
00328 #pragma pack(pop)
00329 
00330     RenameObjectMessage_data_t *data;
00331 
00332    public:
00333     RenameObjectMessage(const char * ini_name, const char * ini_newName);
00334     RenameObjectMessage();
00335     ~RenameObjectMessage();
00336 
00337     RenameObjectMessage(const RenameObjectMessage *m);
00338     /* Methods */
00339     char * name() const;
00340     void set_name(const char * new_name);
00341     size_t maxlenof_name() const;
00342     char * newName() const;
00343     void set_newName(const char * new_newName);
00344     size_t maxlenof_newName() const;
00345     virtual Message * clone() const;
00346   };
00347 
00348   virtual bool message_valid(const Message *message) const;
00349  private:
00350   OpenRaveInterface();
00351   ~OpenRaveInterface();
00352 
00353  public:
00354   /* Methods */
00355   uint32_t msgid() const;
00356   void set_msgid(const uint32_t new_msgid);
00357   size_t maxlenof_msgid() const;
00358   bool is_final() const;
00359   void set_final(const bool new_final);
00360   size_t maxlenof_final() const;
00361   uint32_t error_code() const;
00362   void set_error_code(const uint32_t new_error_code);
00363   size_t maxlenof_error_code() const;
00364   bool is_success() const;
00365   void set_success(const bool new_success);
00366   size_t maxlenof_success() const;
00367   virtual Message * create_message(const char *type) const;
00368 
00369   virtual void copy_values(const Interface *other);
00370   virtual const char * enum_tostring(const char *enumtype, int val) const;
00371 
00372 };
00373 
00374 } // end namespace fawkes
00375 
00376 #endif