Privacy
An open-source, flexible 3D physical simulation framework
DataWidget.h
Go to the documentation of this file.
1 /*
2  * Copyright 2011, 2012, DFKI GmbH Robotics Innovation Center
3  *
4  * This file is part of the MARS simulation framework.
5  *
6  * MARS is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License
8  * as published by the Free Software Foundation, either version 3
9  * of the License, or (at your option) any later version.
10  *
11  * MARS is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with MARS. If not, see <http://www.gnu.org/licenses/>.
18  *
19  */
20 
27 #ifndef DATA_WIDGET_H
28 #define DATA_WIDGET_H
29 
30 #ifdef _PRINT_HEADER_
31 #warning "DataWidget.h"
32 #endif
33 
34 #include <mars/main_gui/PropertyDialog.h>
35 #include <mars/main_gui/BaseWidget.h>
36 #include <mars/data_broker/ReceiverInterface.h>
37 #include <mars/data_broker/DataInfo.h>
38 #include <mars/data_broker/DataPackage.h>
39 
40 #include <vector>
41 #include <set>
42 
43 #include <QWidget>
44 #include <QCloseEvent>
45 #include <QMutex>
46 
47 namespace mars {
48 
49  using namespace std;
50 
51  namespace data_broker {
52  class DataBrokerInterface;
53  }
54 
55  namespace data_broker_gui {
56 
57  class MainDataGui;
58 
59  struct paramWrapper {
62  std::vector<QtVariantProperty*> guiElements;
63  };
64 
68 
69  Q_OBJECT;
70 
71  public:
72  DataWidget(MainDataGui *mainLib, lib_manager::LibManager* libManager,
74  mars::cfg_manager::CFGManagerInterface *cfg, QWidget *parent = 0);
75  ~DataWidget();
76 
77  void addParam(const mars::data_broker::DataInfo _info);
78  virtual void valueChanged(QtProperty *property, const QVariant &value);
79 
81  void receiveData(const mars::data_broker::DataInfo &info,
82  const mars::data_broker::DataPackage &data_package,
83  int callbackParam);
84  // void receiveAddProducer(const data_broker::data_info &info) {}
85  // void receiveRemoveProducer(const data_broker::data_info &info) {}
86 
87  protected:
88  void closeEvent(QCloseEvent *event);
89 
90  private:
94  QtProperty *showAllProperty;
95  bool showAll;
96  QMutex addMutex;
97  QMutex listMutex;
98  QMutex changeMutex;
99 
100  set<unsigned long> changeList;
101  map<unsigned long, paramWrapper> addList;
102  map<unsigned long, paramWrapper> paramList;
103  // map<std::vector<QtVariantProperty*>*, paramWrapper> guiToWrapper;
104  map<QtVariantProperty*, paramWrapper*> guiToWrapper;
106 
107  protected slots:
108  void timerEvent(QTimerEvent* event);
109 
110  };
111 
112  } // end of namespace data_broker_gui
113 
114 } // end of namespace mars
115 
116 #endif // DATA_WIDGET_H
117 
map< unsigned long, paramWrapper > addList
Definition: DataWidget.h:101
main_gui::PropertyDialog * pDialog
Definition: DataWidget.h:80
mars::data_broker::DataBrokerInterface * dataBroker
Definition: DataWidget.h:93
map< QtVariantProperty *, paramWrapper * > guiToWrapper
Definition: DataWidget.h:104
lib_manager::LibManager * libManager
Definition: DataWidget.h:92
Interface for classes that want to receive data from the DataBroker.
Copyright 2012, DFKI GmbH Robotics Innovation Center.
std::vector< QtVariantProperty * > guiElements
Definition: DataWidget.h:62
data_broker::DataPackage dataPackage
Definition: DataWidget.h:61
Class containing information about a DataPackage.
Definition: DataInfo.h:47
map< unsigned long, paramWrapper > paramList
Definition: DataWidget.h:102
Introduced for Windows compatibility.
A collection of DataItems.
Definition: DataPackage.h:44
set< unsigned long > changeList
Definition: DataWidget.h:100
The interface every DataBroker should implement.
The PropertyDialog provides the QtProperty functionality.
data_broker::DataInfo info
Definition: DataWidget.h:60