Fawkes API
Fawkes Development Version
|
24 #include <interfaces/SoccerPenaltyInterface.h>
26 #include <core/exceptions/software.h>
68 SoccerPenaltyInterface::SoccerPenaltyInterface() : Interface()
70 data_size =
sizeof(SoccerPenaltyInterface_data_t);
72 data = (SoccerPenaltyInterface_data_t *)
data_ptr;
78 unsigned char tmp_hash[] = {0xa0, 0xa1, 0xf0, 0xc2, 0x4e, 0x8c, 0xd1, 0xe1, 0xaf, 0x46, 0x11, 0xe9, 0xa0, 0xc8, 0xaf, 0x5d};
83 SoccerPenaltyInterface::~SoccerPenaltyInterface()
115 data->penalty = new_penalty;
126 return data->remaining;
146 data->remaining = new_remaining;
154 if ( strncmp(
"SetPenaltyMessage",
type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
155 return new SetPenaltyMessage();
158 "message type for this interface type.",
type);
169 const SoccerPenaltyInterface *oi = dynamic_cast<const SoccerPenaltyInterface *>(other);
172 type(), other->type());
174 memcpy(data, oi->data,
sizeof(SoccerPenaltyInterface_data_t));
180 throw UnknownTypeException(
"Unknown enum type %s", enumtype);
196 data_size =
sizeof(SetPenaltyMessage_data_t);
199 data = (SetPenaltyMessage_data_t *)
data_ptr;
201 data->penalty = ini_penalty;
207 data_size =
sizeof(SetPenaltyMessage_data_t);
210 data = (SetPenaltyMessage_data_t *)
data_ptr;
229 data = (SetPenaltyMessage_data_t *)
data_ptr;
241 return data->penalty;
261 data->penalty = new_penalty;
289 EXPORT_INTERFACE(SoccerPenaltyInterface)
uint16_t remaining() const
Get remaining value.
static const uint16_t SPL_PENALTY_OBSTRUCTION
SPL_PENALTY_OBSTRUCTION constant.
static const uint16_t SPL_PENALTY_ILLEGAL_DEFENDER
SPL_PENALTY_ILLEGAL_DEFENDER constant.
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.
message_data_ts_t * data_ts
data timestamp aliasing pointer
16 bit unsigned integer field
size_t maxlenof_remaining() const
Get maximum length of remaining value.
const char * type() const
Get type of interface.
SetPenaltyMessage()
Constructor.
virtual Message * create_message(const char *type) const
void add_fieldinfo(interface_fieldtype_t type, const char *name, size_t length, void *value, const char *enumtype=0, const interface_enum_map_t *enum_map=0)
Add an entry to the field info list.
interface_data_ts_t * data_ts
static const uint16_t SPL_PENALTY_INACTIVE_PLAYER
SPL_PENALTY_INACTIVE_PLAYER constant.
static const uint16_t SPL_PENALTY_NONE
SPL_PENALTY_NONE constant.
Timestamp data, must be present and first entries for each interface data structs!...
void set_penalty(const uint16_t new_penalty)
Set penalty value.
void set_remaining(const uint16_t new_remaining)
Set remaining value.
static const uint16_t SPL_PENALTY_PLAYING_WITH_HANDS
SPL_PENALTY_PLAYING_WITH_HANDS constant.
virtual Message * clone() const
Clone this message.
void set_penalty(const uint16_t new_penalty)
Set penalty value.
void set_hash(unsigned char *ihash)
Set hash.
static const uint16_t SPL_PENALTY_BALL_HOLDING
SPL_PENALTY_BALL_HOLDING constant.
virtual void copy_values(const Interface *other)
Copy values from other interface.
static const uint16_t SPL_PENALTY_REQ_FOR_PICKUP
SPL_PENALTY_REQ_FOR_PICKUP constant.
static const uint16_t SPL_PENALTY_LEAVING_THE_FIELD
SPL_PENALTY_LEAVING_THE_FIELD constant.
void add_fieldinfo(interface_fieldtype_t type, const char *name, size_t length, void *value, const char *enumtype=0, const interface_enum_map_t *enum_map=0)
Add an entry to the info list.
size_t maxlenof_penalty() const
Get maximum length of penalty value.
size_t maxlenof_penalty() const
Get maximum length of penalty value.
static const uint16_t SPL_PENALTY_MANUAL
SPL_PENALTY_MANUAL constant.
uint16_t penalty() const
Get penalty value.
~SetPenaltyMessage()
Destructor.
void add_messageinfo(const char *name)
Add an entry to the message info list.
static const uint16_t SPL_PENALTY_PLAYER_PUSHING
SPL_PENALTY_PLAYER_PUSHING constant.
uint16_t penalty() const
Get penalty value.
virtual const char * enum_tostring(const char *enumtype, int val) const