Fawkes API Fawkes Development Version
SoccerPenaltyInterface.h
1
2/***************************************************************************
3 * SoccerPenaltyInterface.h - Fawkes BlackBoard Interface - SoccerPenaltyInterface
4 *
5 * Templated created: Thu Oct 12 10:49:19 2006
6 * Copyright 2008-2010 Tim Niemueller
7 *
8 ****************************************************************************/
9
10/* This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version. A runtime exception applies to
14 * this software (see LICENSE.GPL_WRE file mentioned below for details).
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Library General Public License for more details.
20 *
21 * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22 */
23
24#ifndef _INTERFACES_SOCCERPENALTYINTERFACE_H_
25#define _INTERFACES_SOCCERPENALTYINTERFACE_H_
26
27#include <interface/interface.h>
28#include <interface/message.h>
29#include <interface/field_iterator.h>
30
31namespace fawkes {
32
34{
35 /// @cond INTERNALS
36 INTERFACE_MGMT_FRIENDS(SoccerPenaltyInterface)
37 /// @endcond
38 public:
39 /* constants */
40 static const uint16_t SPL_PENALTY_NONE;
41 static const uint16_t SPL_PENALTY_BALL_HOLDING;
42 static const uint16_t SPL_PENALTY_PLAYER_PUSHING;
43 static const uint16_t SPL_PENALTY_OBSTRUCTION;
44 static const uint16_t SPL_PENALTY_INACTIVE_PLAYER;
45 static const uint16_t SPL_PENALTY_ILLEGAL_DEFENDER;
46 static const uint16_t SPL_PENALTY_LEAVING_THE_FIELD;
47 static const uint16_t SPL_PENALTY_PLAYING_WITH_HANDS;
48 static const uint16_t SPL_PENALTY_REQ_FOR_PICKUP;
49 static const uint16_t SPL_PENALTY_MANUAL;
50
51 private:
52 /** Internal data storage, do NOT modify! */
53 typedef struct {
54 int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
55 int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
56 uint16_t penalty; /**< Current penalty code. */
57 uint16_t remaining; /**< Estimated time in seconds until the robot is unpenalized. */
58 } SoccerPenaltyInterface_data_t;
59
60 SoccerPenaltyInterface_data_t *data;
61
62 public:
63 /* messages */
65 {
66 private:
67 /** Internal data storage, do NOT modify! */
68 typedef struct {
69 int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
70 int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
71 uint16_t penalty; /**< Current penalty code. */
72 } SetPenaltyMessage_data_t;
73
74 SetPenaltyMessage_data_t *data;
75
76 public:
77 SetPenaltyMessage(const uint16_t ini_penalty);
80
81 explicit SetPenaltyMessage(const SetPenaltyMessage *m);
82 /* Methods */
83 uint16_t penalty() const;
84 void set_penalty(const uint16_t new_penalty);
85 size_t maxlenof_penalty() const;
86 virtual Message * clone() const;
87 };
88
89 virtual bool message_valid(const Message *message) const;
90 private:
93
94 public:
95 /* Methods */
96 uint16_t penalty() const;
97 void set_penalty(const uint16_t new_penalty);
98 size_t maxlenof_penalty() const;
99 uint16_t remaining() const;
100 void set_remaining(const uint16_t new_remaining);
101 size_t maxlenof_remaining() const;
102 virtual Message * create_message(const char *type) const;
103
104 virtual void copy_values(const Interface *other);
105 virtual const char * enum_tostring(const char *enumtype, int val) const;
106
107};
108
109} // end namespace fawkes
110
111#endif
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:80
const char * type() const
Get type of interface.
Definition: interface.cpp:652
Base class for all messages passed through interfaces in Fawkes BlackBoard.
Definition: message.h:44
SetPenaltyMessage Fawkes BlackBoard Interface Message.
size_t maxlenof_penalty() const
Get maximum length of penalty value.
void set_penalty(const uint16_t new_penalty)
Set penalty value.
virtual Message * clone() const
Clone this message.
SoccerPenaltyInterface Fawkes BlackBoard Interface.
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.
static const uint16_t SPL_PENALTY_BALL_HOLDING
SPL_PENALTY_BALL_HOLDING constant.
static const uint16_t SPL_PENALTY_NONE
SPL_PENALTY_NONE constant.
static const uint16_t SPL_PENALTY_PLAYER_PUSHING
SPL_PENALTY_PLAYER_PUSHING constant.
static const uint16_t SPL_PENALTY_MANUAL
SPL_PENALTY_MANUAL constant.
static const uint16_t SPL_PENALTY_PLAYING_WITH_HANDS
SPL_PENALTY_PLAYING_WITH_HANDS constant.
size_t maxlenof_remaining() const
Get maximum length of remaining value.
uint16_t remaining() const
Get remaining value.
size_t maxlenof_penalty() const
Get maximum length of penalty value.
static const uint16_t SPL_PENALTY_LEAVING_THE_FIELD
SPL_PENALTY_LEAVING_THE_FIELD constant.
static const uint16_t SPL_PENALTY_INACTIVE_PLAYER
SPL_PENALTY_INACTIVE_PLAYER constant.
virtual const char * enum_tostring(const char *enumtype, int val) const
Convert arbitrary enum value to string.
void set_penalty(const uint16_t new_penalty)
Set penalty value.
uint16_t penalty() const
Get penalty value.
static const uint16_t SPL_PENALTY_ILLEGAL_DEFENDER
SPL_PENALTY_ILLEGAL_DEFENDER constant.
virtual Message * create_message(const char *type) const
Create message based on type name.
void set_remaining(const uint16_t new_remaining)
Set remaining value.
static const uint16_t SPL_PENALTY_REQ_FOR_PICKUP
SPL_PENALTY_REQ_FOR_PICKUP constant.
static const uint16_t SPL_PENALTY_OBSTRUCTION
SPL_PENALTY_OBSTRUCTION constant.
virtual void copy_values(const Interface *other)
Copy values from other interface.
Fawkes library namespace.