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 <mongo/client/dbclient.h>
26 #include <tf/transformer.h>
27 #include <tf/types.h>
28 
29 #include <string>
30 
31 namespace fawkes {
32 namespace tf {
33 
35 {
36 public:
37  MongoDBTransformer(mongo::DBClientBase *mongodb_client,
38  const std::string & database_name,
39  bool ensure_index = true);
40  virtual ~MongoDBTransformer();
41 
42  /** Restore transforms from database.
43  * @param start start time of range to restore
44  * @param end end time of range to restore
45  */
46  void
48  {
49  fawkes::Time no_new_start(0, 0);
50  restore(start, end, no_new_start);
51  }
52 
53  void restore(fawkes::Time &start, fawkes::Time &end, fawkes::Time &new_start);
54  void restore(long long start_msec, long long end_msec, long long new_start_msec = 0);
55 
56 private:
57  void restore_tf_doc(mongo::BSONObj &doc, long long start_msec, long long new_start_msec);
58 
59 private:
60  mongo::DBClientBase *mongodb_client_;
61  std::string database_;
62 };
63 
64 } // end namespace tf
65 } // end namespace fawkes
66 
67 #endif
Fawkes library namespace.
A class for handling time.
Definition: time.h:92
Coordinate transforms between any two frames in a system.
Definition: transformer.h:64
Read transforms from MongoDB and answer queries.
void restore(fawkes::Time &start, fawkes::Time &end)
Restore transforms from database.
MongoDBTransformer(mongo::DBClientBase *mongodb_client, const std::string &database_name, bool ensure_index=true)
Constructor.