24 #include <interfaces/Position2DTrackInterface.h>
26 #include <core/exceptions/software.h>
46 Position2DTrackInterface::Position2DTrackInterface() : Interface()
48 data_size =
sizeof(Position2DTrackInterface_data_t);
49 data_ptr = malloc(data_size);
50 data = (Position2DTrackInterface_data_t *)data_ptr;
51 data_ts = (interface_data_ts_t *)data_ptr;
52 memset(data_ptr, 0, data_size);
53 add_fieldinfo(IFT_FLOAT,
"track_x_positions", 30, &data->track_x_positions);
54 add_fieldinfo(IFT_FLOAT,
"track_y_positions", 30, &data->track_y_positions);
55 add_fieldinfo(IFT_INT32,
"track_timestamps", 30, &data->track_timestamps);
56 add_fieldinfo(IFT_UINT32,
"length", 1, &data->length);
57 add_fieldinfo(IFT_UINT32,
"track_id", 1, &data->track_id);
58 unsigned char tmp_hash[] = {0x48, 0xe9, 0x35, 0x74, 0x18, 0x14, 0x46, 0x31, 0x6e, 0x5c, 0x76, 0x2e, 0x39, 0x1, 0x5, 0x30};
63 Position2DTrackInterface::~Position2DTrackInterface()
76 Position2DTrackInterface::track_x_positions()
const
78 return data->track_x_positions;
91 Position2DTrackInterface::track_x_positions(
unsigned int index)
const
94 throw Exception(
"Index value %u out of bounds (0..29)", index);
96 return data->track_x_positions[index];
104 Position2DTrackInterface::maxlenof_track_x_positions()
const
117 Position2DTrackInterface::set_track_x_positions(
const float * new_track_x_positions)
119 data_changed |=
change_field(data->track_x_positions, new_track_x_positions);
131 Position2DTrackInterface::set_track_x_positions(
unsigned int index,
const float new_track_x_positions)
133 data_changed |=
change_field(data->track_x_positions, index, new_track_x_positions);
143 Position2DTrackInterface::track_y_positions()
const
145 return data->track_y_positions;
158 Position2DTrackInterface::track_y_positions(
unsigned int index)
const
161 throw Exception(
"Index value %u out of bounds (0..29)", index);
163 return data->track_y_positions[index];
171 Position2DTrackInterface::maxlenof_track_y_positions()
const
184 Position2DTrackInterface::set_track_y_positions(
const float * new_track_y_positions)
186 data_changed |=
change_field(data->track_y_positions, new_track_y_positions);
198 Position2DTrackInterface::set_track_y_positions(
unsigned int index,
const float new_track_y_positions)
200 data_changed |=
change_field(data->track_y_positions, index, new_track_y_positions);
210 Position2DTrackInterface::track_timestamps()
const
212 return data->track_timestamps;
225 Position2DTrackInterface::track_timestamps(
unsigned int index)
const
228 throw Exception(
"Index value %u out of bounds (0..29)", index);
230 return data->track_timestamps[index];
238 Position2DTrackInterface::maxlenof_track_timestamps()
const
251 Position2DTrackInterface::set_track_timestamps(
const int32_t * new_track_timestamps)
253 data_changed |=
change_field(data->track_timestamps, new_track_timestamps);
265 Position2DTrackInterface::set_track_timestamps(
unsigned int index,
const int32_t new_track_timestamps)
267 data_changed |=
change_field(data->track_timestamps, index, new_track_timestamps);
274 Position2DTrackInterface::length()
const
284 Position2DTrackInterface::maxlenof_length()
const
294 Position2DTrackInterface::set_length(
const uint32_t new_length)
304 Position2DTrackInterface::track_id()
const
306 return data->track_id;
314 Position2DTrackInterface::maxlenof_track_id()
const
324 Position2DTrackInterface::set_track_id(
const uint32_t new_track_id)
326 data_changed |=
change_field(data->track_id, new_track_id);
331 Position2DTrackInterface::create_message(
const char *type)
const
334 "message type for this interface type.", type);
342 Position2DTrackInterface::copy_values(
const Interface *other)
347 type(), other->
type());
349 memcpy(data, oi->data,
sizeof(Position2DTrackInterface_data_t));
353 Position2DTrackInterface::enum_tostring(
const char *enumtype,
int val)
const
364 Position2DTrackInterface::message_valid(
const Message *message)
const
Base class for exceptions in Fawkes.
Base class for all Fawkes BlackBoard interfaces.
const char * type() const
Get type of interface.
Base class for all messages passed through interfaces in Fawkes BlackBoard.
Position2DTrackInterface Fawkes BlackBoard Interface.
Fawkes library namespace.
bool change_field(FieldT &field, const DataT &value)
Set a field and return whether it changed.