Fawkes API  Fawkes Development Version
LaserBoxFilterInterface.h
1 
2 /***************************************************************************
3  * LaserBoxFilterInterface.h - Fawkes BlackBoard Interface - LaserBoxFilterInterface
4  *
5  * Templated created: Thu Oct 12 10:49:19 2006
6  * Copyright 2018 Nicolas Limpert
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_LASERBOXFILTERINTERFACE_H_
25 #define _INTERFACES_LASERBOXFILTERINTERFACE_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(LaserBoxFilterInterface)
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  uint32_t num_boxes; /**< The number of currently applied boxes */
47  } LaserBoxFilterInterface_data_t;
48 
49  LaserBoxFilterInterface_data_t *data;
50 
51  public:
52  /* messages */
54  {
55  private:
56  /** Internal data storage, do NOT modify! */
57  typedef struct __attribute__((packed)) {
58  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
59  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
60  double p1[2]; /**< x,y coordinates of first vector */
61  double p2[2]; /**< x,y coordinates of second vector */
62  double p3[2]; /**< x,y coordinates of third vector */
63  double p4[2]; /**< x,y coordinates of fourth vector */
64  } CreateNewBoxFilterMessage_data_t;
65 
66  CreateNewBoxFilterMessage_data_t *data;
67 
68  public:
69  CreateNewBoxFilterMessage(const double * ini_p1, const double * ini_p2, const double * ini_p3, const double * ini_p4);
72 
74  /* Methods */
75  double * p1() const;
76  double p1(unsigned int index) const;
77  void set_p1(unsigned int index, const double new_p1);
78  void set_p1(const double * new_p1);
79  size_t maxlenof_p1() const;
80  double * p2() const;
81  double p2(unsigned int index) const;
82  void set_p2(unsigned int index, const double new_p2);
83  void set_p2(const double * new_p2);
84  size_t maxlenof_p2() const;
85  double * p3() const;
86  double p3(unsigned int index) const;
87  void set_p3(unsigned int index, const double new_p3);
88  void set_p3(const double * new_p3);
89  size_t maxlenof_p3() const;
90  double * p4() const;
91  double p4(unsigned int index) const;
92  void set_p4(unsigned int index, const double new_p4);
93  void set_p4(const double * new_p4);
94  size_t maxlenof_p4() const;
95  virtual Message * clone() const;
96  };
97 
98  virtual bool message_valid(const Message *message) const;
99  private:
102 
103  public:
104  /* Methods */
105  uint32_t num_boxes() const;
106  void set_num_boxes(const uint32_t new_num_boxes);
107  size_t maxlenof_num_boxes() const;
108  virtual Message * create_message(const char *type) const;
109 
110  virtual void copy_values(const Interface *other);
111  virtual const char * enum_tostring(const char *enumtype, int val) const;
112 
113 };
114 
115 } // end namespace fawkes
116 
117 #endif
size_t maxlenof_p3() const
Get maximum length of p3 value.
Base class for all messages passed through interfaces in Fawkes BlackBoard.
Definition: message.h:41
void set_p3(unsigned int index, const double new_p3)
Set p3 value at given index.
Fawkes library namespace.
size_t maxlenof_p1() const
Get maximum length of p1 value.
void set_num_boxes(const uint32_t new_num_boxes)
Set num_boxes value.
size_t maxlenof_num_boxes() const
Get maximum length of num_boxes value.
void set_p1(unsigned int index, const double new_p1)
Set p1 value at given index.
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:78
LaserBoxFilterInterface Fawkes BlackBoard Interface.
const char * type() const
Get type of interface.
Definition: interface.cpp:640
virtual void copy_values(const Interface *other)
Copy values from other interface.
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.
size_t maxlenof_p2() const
Get maximum length of p2 value.
virtual const char * enum_tostring(const char *enumtype, int val) const
Convert arbitrary enum value to string.
uint32_t num_boxes() const
Get num_boxes value.
virtual Message * create_message(const char *type) const
Create message based on type name.
CreateNewBoxFilterMessage Fawkes BlackBoard Interface Message.
size_t maxlenof_p4() const
Get maximum length of p4 value.
void set_p4(unsigned int index, const double new_p4)
Set p4 value at given index.
void set_p2(unsigned int index, const double new_p2)
Set p2 value at given index.