Fawkes API  Fawkes Development Version
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
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 #pragma pack(push,4)
43  /** Internal data storage, do NOT modify! */
44  typedef struct {
45  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
46  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
47  float track_x_positions[30]; /**<
48  X-Positions of the track. The first array-element is the oldest position of the track,
49  the last is the newest.
50  */
51  float track_y_positions[30]; /**<
52  Y-Positions of the track. The first array-element is the oldest position of the track,
53  the last is the newest.
54  */
55  int32_t track_timestamps[30]; /**<
56  Timestamps of the track. The first array-element is the oldest position of the track,
57  the last is the newest.
58  */
59  bool valid; /**< True, if this track is valid. */
60  uint32_t length; /**< Length of the Tracks (i.e. up to which index there are valid positions). */
61  uint32_t track_id; /**< The ID of the Track. */
62  } Position2DTrackInterface_data_t;
63 #pragma pack(pop)
64 
65  Position2DTrackInterface_data_t *data;
66 
67  public:
68  /* messages */
69  virtual bool message_valid(const Message *message) const;
70  private:
73 
74  public:
75  /* Methods */
76  float * track_x_positions() const;
77  float track_x_positions(unsigned int index) const;
78  void set_track_x_positions(unsigned int index, const float new_track_x_positions);
79  void set_track_x_positions(const float * new_track_x_positions);
80  size_t maxlenof_track_x_positions() const;
81  float * track_y_positions() const;
82  float track_y_positions(unsigned int index) const;
83  void set_track_y_positions(unsigned int index, const float new_track_y_positions);
84  void set_track_y_positions(const float * new_track_y_positions);
85  size_t maxlenof_track_y_positions() const;
86  int32_t * track_timestamps() const;
87  int32_t track_timestamps(unsigned int index) const;
88  void set_track_timestamps(unsigned int index, const int32_t new_track_timestamps);
89  void set_track_timestamps(const int32_t * new_track_timestamps);
90  size_t maxlenof_track_timestamps() const;
91  bool is_valid() const;
92  void set_valid(const bool new_valid);
93  size_t maxlenof_valid() const;
94  uint32_t length() const;
95  void set_length(const uint32_t new_length);
96  size_t maxlenof_length() const;
97  uint32_t track_id() const;
98  void set_track_id(const uint32_t new_track_id);
99  size_t maxlenof_track_id() const;
100  virtual Message * create_message(const char *type) const;
101 
102  virtual void copy_values(const Interface *other);
103  virtual const char * enum_tostring(const char *enumtype, int val) const;
104 
105 };
106 
107 } // end namespace fawkes
108 
109 #endif