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