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 
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 __attribute__((packed)) {
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  bool valid; /**< True, if this track is valid. */
59  uint32_t length; /**< Length of the Tracks (i.e. up to which index there are valid positions). */
60  uint32_t track_id; /**< The ID of the Track. */
61  } Position2DTrackInterface_data_t;
62 
63  Position2DTrackInterface_data_t *data;
64 
65  public:
66  /* messages */
67  virtual bool message_valid(const Message *message) const;
68  private:
71 
72  public:
73  /* Methods */
74  float * track_x_positions() const;
75  float track_x_positions(unsigned int index) const;
76  void set_track_x_positions(unsigned int index, const float new_track_x_positions);
77  void set_track_x_positions(const float * new_track_x_positions);
78  size_t maxlenof_track_x_positions() const;
79  float * track_y_positions() const;
80  float track_y_positions(unsigned int index) const;
81  void set_track_y_positions(unsigned int index, const float new_track_y_positions);
82  void set_track_y_positions(const float * new_track_y_positions);
83  size_t maxlenof_track_y_positions() const;
84  int32_t * track_timestamps() const;
85  int32_t track_timestamps(unsigned int index) const;
86  void set_track_timestamps(unsigned int index, const int32_t new_track_timestamps);
87  void set_track_timestamps(const int32_t * new_track_timestamps);
88  size_t maxlenof_track_timestamps() const;
89  bool is_valid() const;
90  void set_valid(const bool new_valid);
91  size_t maxlenof_valid() const;
92  uint32_t length() const;
93  void set_length(const uint32_t new_length);
94  size_t maxlenof_length() const;
95  uint32_t track_id() const;
96  void set_track_id(const uint32_t new_track_id);
97  size_t maxlenof_track_id() const;
98  virtual Message * create_message(const char *type) const;
99 
100  virtual void copy_values(const Interface *other);
101  virtual const char * enum_tostring(const char *enumtype, int val) const;
102 
103 };
104 
105 } // end namespace fawkes
106 
107 #endif
void set_valid(const bool new_valid)
Set valid value.
Base class for all messages passed through interfaces in Fawkes BlackBoard.
Definition: message.h:44
float * track_x_positions() const
Get track_x_positions value.
void set_track_x_positions(unsigned int index, const float new_track_x_positions)
Set track_x_positions value at given index.
Fawkes library namespace.
size_t maxlenof_track_y_positions() const
Get maximum length of track_y_positions value.
size_t maxlenof_valid() const
Get maximum length of valid value.
void set_track_id(const uint32_t new_track_id)
Set track_id value.
uint32_t length() const
Get length value.
virtual const char * enum_tostring(const char *enumtype, int val) const
Convert arbitrary enum value to string.
virtual Message * create_message(const char *type) const
Create message based on type name.
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:79
uint32_t track_id() const
Get track_id value.
void set_track_y_positions(unsigned int index, const float new_track_y_positions)
Set track_y_positions value at given index.
void set_track_timestamps(unsigned int index, const int32_t new_track_timestamps)
Set track_timestamps value at given index.
bool is_valid() const
Get valid value.
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.
float * track_y_positions() const
Get track_y_positions value.
const char * type() const
Get type of interface.
Definition: interface.cpp:651
size_t maxlenof_track_x_positions() const
Get maximum length of track_x_positions value.
size_t maxlenof_track_timestamps() const
Get maximum length of track_timestamps value.
virtual void copy_values(const Interface *other)
Copy values from other interface.
size_t maxlenof_length() const
Get maximum length of length value.
void set_length(const uint32_t new_length)
Set length value.
size_t maxlenof_track_id() const
Get maximum length of track_id value.
int32_t * track_timestamps() const
Get track_timestamps value.
Position2DTrackInterface Fawkes BlackBoard Interface.