Fawkes API  Fawkes Development Version
PclDatabaseRetrieveInterface.h
1 
2 /***************************************************************************
3  * PclDatabaseRetrieveInterface.h - Fawkes BlackBoard Interface - PclDatabaseRetrieveInterface
4  *
5  * Templated created: Thu Oct 12 10:49:19 2006
6  * Copyright 2012-2013 Tim Niemueller
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_PCLDATABASERETRIEVEINTERFACE_H_
25 #define __INTERFACES_PCLDATABASERETRIEVEINTERFACE_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(PclDatabaseRetrieveInterface)
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 msgid; /**<
47  The ID of the message that is currently being processed, or 0 if
48  no message is being processed.
49  */
50  bool final; /**<
51  True, if the last goto command has been finished, false if it is
52  still running.
53  */
54  char error[256]; /**<
55  Error description if reconstruction fails.
56  */
57  } PclDatabaseRetrieveInterface_data_t;
58 
59  PclDatabaseRetrieveInterface_data_t *data;
60 
61  public:
62  /* messages */
63  class RetrieveMessage : public Message
64  {
65  private:
66  /** Internal data storage, do NOT modify! */
67  typedef struct __attribute__((packed)) {
68  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
69  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
70  int64_t timestamp; /**<
71  Timestamp for which to retrieve the most recent point clouds.
72  */
73  char database[64]; /**<
74  Database name from which to read the point clouds. If empty will
75  use plugin-configured default.
76  */
77  char collection[128]; /**<
78  Collection name from which to read the point clouds. May NOT
79  include the database name.
80  */
81  char target_frame[64]; /**<
82  Coordinate frame to which to transform the output point cloud.
83  The transformation will be done through a fixed frame specified
84  in the plugin config. If empty, no transformation is
85  performed. If set to "SENSOR" will convert to the sensor frame
86  specified in the plugin config.
87  */
88  bool original_timestamp; /**<
89  Set to true to set the original timestamp on the point cloud,
90  false (default) to publish with current time.
91  */
92  } RetrieveMessage_data_t;
93 
94  RetrieveMessage_data_t *data;
95 
96  public:
97  RetrieveMessage(const int64_t ini_timestamp, const char * ini_database, const char * ini_collection, const char * ini_target_frame, const bool ini_original_timestamp);
99  ~RetrieveMessage();
100 
102  /* Methods */
103  int64_t timestamp() const;
104  void set_timestamp(const int64_t new_timestamp);
105  size_t maxlenof_timestamp() const;
106  char * database() const;
107  void set_database(const char * new_database);
108  size_t maxlenof_database() const;
109  char * collection() const;
110  void set_collection(const char * new_collection);
111  size_t maxlenof_collection() const;
112  char * target_frame() const;
113  void set_target_frame(const char * new_target_frame);
114  size_t maxlenof_target_frame() const;
115  bool is_original_timestamp() const;
116  void set_original_timestamp(const bool new_original_timestamp);
117  size_t maxlenof_original_timestamp() const;
118  virtual Message * clone() const;
119  };
120 
121  virtual bool message_valid(const Message *message) const;
122  private:
125 
126  public:
127  /* Methods */
128  uint32_t msgid() const;
129  void set_msgid(const uint32_t new_msgid);
130  size_t maxlenof_msgid() const;
131  bool is_final() const;
132  void set_final(const bool new_final);
133  size_t maxlenof_final() const;
134  char * error() const;
135  void set_error(const char * new_error);
136  size_t maxlenof_error() const;
137  virtual Message * create_message(const char *type) const;
138 
139  virtual void copy_values(const Interface *other);
140  virtual const char * enum_tostring(const char *enumtype, int val) const;
141 
142 };
143 
144 } // end namespace fawkes
145 
146 #endif
Base class for all messages passed through interfaces in Fawkes BlackBoard.
Definition: message.h:44
RetrieveMessage Fawkes BlackBoard Interface Message.
void set_final(const bool new_final)
Set final value.
void set_error(const char *new_error)
Set error value.
PclDatabaseRetrieveInterface Fawkes BlackBoard Interface.
Fawkes library namespace.
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:79
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.
size_t maxlenof_final() const
Get maximum length of final value.
virtual Message * create_message(const char *type) const
Create message based on type name.
void set_msgid(const uint32_t new_msgid)
Set msgid value.
const char * type() const
Get type of interface.
Definition: interface.cpp:651
virtual void copy_values(const Interface *other)
Copy values from other interface.
virtual const char * enum_tostring(const char *enumtype, int val) const
Convert arbitrary enum value to string.
size_t maxlenof_msgid() const
Get maximum length of msgid value.
size_t maxlenof_error() const
Get maximum length of error value.
const Time * timestamp() const
Get timestamp of last write.
Definition: interface.cpp:718
void set_timestamp(const Time *t=NULL)
Set timestamp.
Definition: interface.cpp:729