SoccerPenaltyInterface.h

00001 
00002 /***************************************************************************
00003  *  SoccerPenaltyInterface.h - Fawkes BlackBoard Interface - SoccerPenaltyInterface
00004  *
00005  *  Templated created:   Thu Oct 12 10:49:19 2006
00006  *  Copyright  2008-2010  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_SOCCERPENALTYINTERFACE_H_
00025 #define __INTERFACES_SOCCERPENALTYINTERFACE_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 SoccerPenaltyInterface : public Interface
00034 {
00035  /// @cond INTERNALS
00036  INTERFACE_MGMT_FRIENDS(SoccerPenaltyInterface)
00037  /// @endcond
00038  public:
00039   /* constants */
00040   static const uint16_t SPL_PENALTY_NONE;
00041   static const uint16_t SPL_PENALTY_BALL_HOLDING;
00042   static const uint16_t SPL_PENALTY_PLAYER_PUSHING;
00043   static const uint16_t SPL_PENALTY_OBSTRUCTION;
00044   static const uint16_t SPL_PENALTY_INACTIVE_PLAYER;
00045   static const uint16_t SPL_PENALTY_ILLEGAL_DEFENDER;
00046   static const uint16_t SPL_PENALTY_LEAVING_THE_FIELD;
00047   static const uint16_t SPL_PENALTY_PLAYING_WITH_HANDS;
00048   static const uint16_t SPL_PENALTY_REQ_FOR_PICKUP;
00049   static const uint16_t SPL_PENALTY_MANUAL;
00050 
00051  private:
00052 #pragma pack(push,4)
00053   /** Internal data storage, do NOT modify! */
00054   typedef struct {
00055     int64_t timestamp_sec;  /**< Interface Unix timestamp, seconds */
00056     int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
00057     uint16_t penalty; /**< Current penalty code. */
00058     uint16_t remaining; /**< Estimated time in seconds until the robot is unpenalized. */
00059   } SoccerPenaltyInterface_data_t;
00060 #pragma pack(pop)
00061 
00062   SoccerPenaltyInterface_data_t *data;
00063 
00064  public:
00065   /* messages */
00066   class SetPenaltyMessage : public Message
00067   {
00068    private:
00069 #pragma pack(push,4)
00070     /** Internal data storage, do NOT modify! */
00071     typedef struct {
00072       int64_t timestamp_sec;  /**< Interface Unix timestamp, seconds */
00073       int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
00074       uint16_t penalty; /**< Current penalty code. */
00075     } SetPenaltyMessage_data_t;
00076 #pragma pack(pop)
00077 
00078     SetPenaltyMessage_data_t *data;
00079 
00080    public:
00081     SetPenaltyMessage(const uint16_t ini_penalty);
00082     SetPenaltyMessage();
00083     ~SetPenaltyMessage();
00084 
00085     SetPenaltyMessage(const SetPenaltyMessage *m);
00086     /* Methods */
00087     uint16_t penalty() const;
00088     void set_penalty(const uint16_t new_penalty);
00089     size_t maxlenof_penalty() const;
00090     virtual Message * clone() const;
00091   };
00092 
00093   virtual bool message_valid(const Message *message) const;
00094  private:
00095   SoccerPenaltyInterface();
00096   ~SoccerPenaltyInterface();
00097 
00098  public:
00099   /* Methods */
00100   uint16_t penalty() const;
00101   void set_penalty(const uint16_t new_penalty);
00102   size_t maxlenof_penalty() const;
00103   uint16_t remaining() const;
00104   void set_remaining(const uint16_t new_remaining);
00105   size_t maxlenof_remaining() const;
00106   virtual Message * create_message(const char *type) const;
00107 
00108   virtual void copy_values(const Interface *other);
00109   virtual const char * enum_tostring(const char *enumtype, int val) const;
00110 
00111 };
00112 
00113 } // end namespace fawkes
00114 
00115 #endif

Generated on 1 Mar 2011 for Fawkes API by  doxygen 1.6.1