Fawkes API  Fawkes Development Version
Position2DTrackInterface.h
1 
2 /***************************************************************************
3  * Position2DTrackInterface.h - Fawkes BlackBoard Interface - Position2DTrackInterface
4  *
5  * Templated created: Thu Oct 12 10:49:19 2006
6  * Copyright 2009 Masrur Doostdar
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_POSITION2DTRACKINTERFACE_H_
25 #define _INTERFACES_POSITION2DTRACKINTERFACE_H_
26 
27 #include <interface/interface.h>
28 #include <interface/message.h>
29 #include <interface/field_iterator.h>
30 
31 namespace fawkes {
32 
33 class Position2DTrackInterface : public Interface
34 {
35  /// @cond INTERNALS
36  INTERFACE_MGMT_FRIENDS(Position2DTrackInterface)
37  /// @endcond
38  public:
39  /* constants */
40 
41  private:
42  /** Internal data storage, do NOT modify! */
43  typedef struct {
44  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
45  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
46  float track_x_positions[30]; /**<
47  X-Positions of the track. The first array-element is the oldest position of the track,
48  the last is the newest.
49  */
50  float track_y_positions[30]; /**<
51  Y-Positions of the track. The first array-element is the oldest position of the track,
52  the last is the newest.
53  */
54  int32_t track_timestamps[30]; /**<
55  Timestamps of the track. The first array-element is the oldest position of the track,
56  the last is the newest.
57  */
58  uint32_t length; /**< Length of the Tracks (i.e. up to which index there are valid positions). */
59  uint32_t track_id; /**< The ID of the Track. */
60  } Position2DTrackInterface_data_t;
61 
62  Position2DTrackInterface_data_t *data;
63 
64  public:
65  /* messages */
66  virtual bool message_valid(const Message *message) const;
67  private:
70 
71  public:
72  /* Methods */
73  float * track_x_positions() const;
74  float track_x_positions(unsigned int index) const;
75  void set_track_x_positions(unsigned int index, const float new_track_x_positions);
76  void set_track_x_positions(const float * new_track_x_positions);
77  size_t maxlenof_track_x_positions() const;
78  float * track_y_positions() const;
79  float track_y_positions(unsigned int index) const;
80  void set_track_y_positions(unsigned int index, const float new_track_y_positions);
81  void set_track_y_positions(const float * new_track_y_positions);
82  size_t maxlenof_track_y_positions() const;
83  int32_t * track_timestamps() const;
84  int32_t track_timestamps(unsigned int index) const;
85  void set_track_timestamps(unsigned int index, const int32_t new_track_timestamps);
86  void set_track_timestamps(const int32_t * new_track_timestamps);
87  size_t maxlenof_track_timestamps() const;
88  uint32_t length() const;
89  void set_length(const uint32_t new_length);
90  size_t maxlenof_length() const;
91  uint32_t track_id() const;
92  void set_track_id(const uint32_t new_track_id);
93  size_t maxlenof_track_id() const;
94  virtual Message * create_message(const char *type) const;
95 
96  virtual void copy_values(const Interface *other);
97  virtual const char * enum_tostring(const char *enumtype, int val) const;
98 
99 };
100 
101 } // end namespace fawkes
102 
103 #endif
fawkes::Position2DTrackInterface::maxlenof_track_x_positions
size_t maxlenof_track_x_positions() const
Get maximum length of track_x_positions value.
Definition: Position2DTrackInterface.cpp:108
fawkes::Position2DTrackInterface::copy_values
virtual void copy_values(const Interface *other)
Copy values from other interface.
Definition: Position2DTrackInterface.cpp:363
fawkes::Position2DTrackInterface::maxlenof_track_timestamps
size_t maxlenof_track_timestamps() const
Get maximum length of track_timestamps value.
Definition: Position2DTrackInterface.cpp:252
fawkes::Position2DTrackInterface::maxlenof_length
size_t maxlenof_length() const
Get maximum length of length value.
Definition: Position2DTrackInterface.cpp:303
fawkes::Message
Definition: message.h:40
fawkes::Position2DTrackInterface::set_length
void set_length(const uint32_t new_length)
Set length value.
Definition: Position2DTrackInterface.cpp:313
fawkes::Position2DTrackInterface::maxlenof_track_id
size_t maxlenof_track_id() const
Get maximum length of track_id value.
Definition: Position2DTrackInterface.cpp:334
fawkes::Interface::type
const char * type() const
Get type of interface.
Definition: interface.cpp:643
fawkes::Position2DTrackInterface::track_timestamps
int32_t * track_timestamps() const
Get track_timestamps value.
Definition: Position2DTrackInterface.cpp:224
fawkes
fawkes::Interface
Definition: interface.h:77
fawkes::Position2DTrackInterface::track_x_positions
float * track_x_positions() const
Get track_x_positions value.
Definition: Position2DTrackInterface.cpp:80
fawkes::Position2DTrackInterface::set_track_x_positions
void set_track_x_positions(unsigned int index, const float new_track_x_positions)
Set track_x_positions value at given index.
Definition: Position2DTrackInterface.cpp:136
fawkes::Position2DTrackInterface::set_track_id
void set_track_id(const uint32_t new_track_id)
Set track_id value.
Definition: Position2DTrackInterface.cpp:344
fawkes::Position2DTrackInterface::create_message
virtual Message * create_message(const char *type) const
Definition: Position2DTrackInterface.cpp:352
fawkes::Position2DTrackInterface::maxlenof_track_y_positions
size_t maxlenof_track_y_positions() const
Get maximum length of track_y_positions value.
Definition: Position2DTrackInterface.cpp:180
fawkes::Position2DTrackInterface::length
uint32_t length() const
Get length value.
Definition: Position2DTrackInterface.cpp:293
fawkes::Position2DTrackInterface::track_id
uint32_t track_id() const
Get track_id value.
Definition: Position2DTrackInterface.cpp:324
fawkes::Position2DTrackInterface::enum_tostring
virtual const char * enum_tostring(const char *enumtype, int val) const
Definition: Position2DTrackInterface.cpp:374
fawkes::Position2DTrackInterface::message_valid
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.
Definition: Position2DTrackInterface.cpp:385
fawkes::Position2DTrackInterface
Definition: Position2DTrackInterface.h:37
fawkes::Position2DTrackInterface::track_y_positions
float * track_y_positions() const
Get track_y_positions value.
Definition: Position2DTrackInterface.cpp:152
fawkes::Position2DTrackInterface::set_track_y_positions
void set_track_y_positions(unsigned int index, const float new_track_y_positions)
Set track_y_positions value at given index.
Definition: Position2DTrackInterface.cpp:208
fawkes::Position2DTrackInterface::set_track_timestamps
void set_track_timestamps(unsigned int index, const int32_t new_track_timestamps)
Set track_timestamps value at given index.
Definition: Position2DTrackInterface.cpp:280