24#include <interfaces/SoccerPenaltyInterface.h>
26#include <core/exceptions/software.h>
68SoccerPenaltyInterface::SoccerPenaltyInterface() : Interface()
70 data_size =
sizeof(SoccerPenaltyInterface_data_t);
71 data_ptr = malloc(data_size);
72 data = (SoccerPenaltyInterface_data_t *)data_ptr;
73 data_ts = (interface_data_ts_t *)data_ptr;
74 memset(data_ptr, 0, data_size);
75 add_fieldinfo(IFT_UINT16,
"penalty", 1, &data->penalty);
76 add_fieldinfo(IFT_UINT16,
"remaining", 1, &data->remaining);
77 add_messageinfo(
"SetPenaltyMessage");
78 unsigned char tmp_hash[] = {0xa0, 0xa1, 0xf0, 0xc2, 0x4e, 0x8c, 0xd1, 0xe1, 0xaf, 0x46, 0x11, 0xe9, 0xa0, 0xc8, 0xaf, 0x5d};
83SoccerPenaltyInterface::~SoccerPenaltyInterface()
93SoccerPenaltyInterface::penalty()
const
103SoccerPenaltyInterface::maxlenof_penalty()
const
113SoccerPenaltyInterface::set_penalty(
const uint16_t new_penalty)
115 set_field(data->penalty, new_penalty);
123SoccerPenaltyInterface::remaining()
const
125 return data->remaining;
133SoccerPenaltyInterface::maxlenof_remaining()
const
143SoccerPenaltyInterface::set_remaining(
const uint16_t new_remaining)
145 set_field(data->remaining, new_remaining);
150SoccerPenaltyInterface::create_message(
const char *type)
const
152 if ( strncmp(
"SetPenaltyMessage", type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
156 "message type for this interface type.", type);
165SoccerPenaltyInterface::copy_values(
const Interface *other)
170 type(), other->
type());
172 memcpy(data, oi->data,
sizeof(SoccerPenaltyInterface_data_t));
176SoccerPenaltyInterface::enum_tostring(
const char *enumtype,
int val)
const
192SoccerPenaltyInterface::SetPenaltyMessage::SetPenaltyMessage(
const uint16_t ini_penalty) :
Message(
"SetPenaltyMessage")
194 data_size =
sizeof(SetPenaltyMessage_data_t);
197 data = (SetPenaltyMessage_data_t *)
data_ptr;
199 data->penalty = ini_penalty;
205 data_size =
sizeof(SetPenaltyMessage_data_t);
208 data = (SetPenaltyMessage_data_t *)
data_ptr;
227 data = (SetPenaltyMessage_data_t *)
data_ptr;
239 return data->penalty;
Base class for all Fawkes BlackBoard interfaces.
const char * type() const
Get type of interface.
void * data_ptr
Pointer to local memory storage.
void set_field(FieldT &field, DataT &data)
Set a field, set data_changed to true and update data_changed accordingly.
Base class for all messages passed through interfaces in Fawkes BlackBoard.
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.
void * data_ptr
Pointer to memory that contains local data.
message_data_ts_t * data_ts
data timestamp aliasing pointer
unsigned int data_size
Size of memory needed to hold all data.
SetPenaltyMessage Fawkes BlackBoard Interface Message.
size_t maxlenof_penalty() const
Get maximum length of penalty value.
uint16_t penalty() const
Get penalty value.
void set_penalty(const uint16_t new_penalty)
Set penalty value.
SetPenaltyMessage()
Constructor.
~SetPenaltyMessage()
Destructor.
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.
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.
static const uint16_t SPL_PENALTY_ILLEGAL_DEFENDER
SPL_PENALTY_ILLEGAL_DEFENDER constant.
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.
Fawkes library namespace.
@ IFT_UINT16
16 bit unsigned integer field
Timestamp data, must be present and first entries for each interface data structs!...