Fawkes API  Fawkes Development Version
mongodb_tf_transformer.h
1 /***************************************************************************
2  * mongodb_tf_transformer.h - Read and provide TFs from MongoDB
3  *
4  * Created: Thu Nov 29 22:55:41 2012
5  * Copyright 2012 Tim Niemueller [www.niemueller.de]
6  ****************************************************************************/
7 
8 /* This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version. A runtime exception applies to
12  * this software (see LICENSE.GPL_WRE file mentioned below for details).
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU Library General Public License for more details.
18  *
19  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
20  */
21 
22 #ifndef _PLUGINS_PERCEPTION_PCL_DB_MERGE_MONGODB_TF_TRANSFORMER_H_
23 #define _PLUGINS_PERCEPTION_PCL_DB_MERGE_MONGODB_TF_TRANSFORMER_H_
24 
25 #include <tf/transformer.h>
26 #include <tf/types.h>
27 
28 #include <bsoncxx/document/view.hpp>
29 #include <mongocxx/client.hpp>
30 #include <string>
31 
32 namespace fawkes {
33 namespace tf {
34 
36 {
37 public:
38  MongoDBTransformer(mongocxx::client * mongodb_client,
39  const std::string &database_name,
40  bool ensure_index = true);
41  virtual ~MongoDBTransformer();
42 
43  /** Restore transforms from database.
44  * @param start start time of range to restore
45  * @param end end time of range to restore
46  */
47  void
49  {
50  fawkes::Time no_new_start(0, 0);
51  restore(start, end, no_new_start);
52  }
53 
54  void restore(fawkes::Time &start, fawkes::Time &end, fawkes::Time &new_start);
55  void restore(long start_msec, long end_msec, long new_start_msec = 0);
56 
57 private:
58  void restore_tf_doc(const bsoncxx::document::view &doc,
59  long long start_msec,
60  long long new_start_msec);
61 
62 private:
63  mongocxx::client *mongodb_client_;
64  std::string database_;
65 };
66 
67 } // end namespace tf
68 } // end namespace fawkes
69 
70 #endif
A class for handling time.
Definition: time.h:93
Read transforms from MongoDB and answer queries.
void restore(fawkes::Time &start, fawkes::Time &end)
Restore transforms from database.
MongoDBTransformer(mongocxx::client *mongodb_client, const std::string &database_name, bool ensure_index=true)
Constructor.
Coordinate transforms between any two frames in a system.
Definition: transformer.h:65
Fawkes library namespace.