roviz  0.7
Code Documentation of roviz
config_impl_dev.h
1 #ifndef CONFIG_IMPL_DEV_H
2 #define CONFIG_IMPL_DEV_H
3 
4 #include <mutex>
5 #include <functional>
6 #include <string>
7 #include <list>
8 #include "core/export_handling.h"
9 #include "config/config_impl.h"
10 #include "config/config_storage_type.h"
11 #include "config/file_path.h"
12 #include "backend_dev/config_impl_base_dev.h"
13 
14 class QWidget;
15 class RovizItemBaseDev;
16 
26 template<typename T>
27 class ROVIZ_EXPORT ConfigImplDev : public ConfigImplBaseDev
28 {
29 COPY_DELETE(ConfigImplDev<T>)
30 MOVE_DELETE(ConfigImplDev<T>)
31 
32 public:
40  // Int
42  ConfigImplDev(RovizItemBaseDev *parent, const std::string &name, const typename ConfigStorageType<T>::type &default_value, int min, int max, bool restart_when_changed);
43 
44  // Double
45  ConfigImplDev(RovizItemBaseDev *parent, const std::string &name, const typename ConfigStorageType<T>::type &default_value, double min, double max, bool restart_when_changed);
46 
47  // String
48  ConfigImplDev(RovizItemBaseDev *parent, const std::string &name, const typename ConfigStorageType<T>::type &default_value, std::function<bool (std::string&)> checker, bool restart_when_changed);
49 
50  // List
51  ConfigImplDev(RovizItemBaseDev *parent, const std::string &name, const typename ConfigStorageType<T>::type &default_value, const std::list<std::string> &possibilities, bool restart_when_changed);
52 
53  // Bool
54  ConfigImplDev(RovizItemBaseDev *parent, const std::string &name, const typename ConfigStorageType<T>::type &default_value, bool restart_when_changed);
55 
56  // Path
57  ConfigImplDev(RovizItemBaseDev *parent, const std::string &name, const typename ConfigStorageType<T>::type &default_value, enum FilePath::Mode file_mode, const std::string &filter, bool restart_when_changed);
59 
66  QWidget *widget(void) const override;
67 
76  void load(void);
77 
81  bool changed(void) override;
82 
91  void refresh(void) override;
92 
99  void lock(void) override;
100 
107  void unlock(void) override;
108 
115  void *value(void) override;
116 
117 private:
118  RovizItemBaseDev *parent;
119  std::string name;
120  typename ConfigStorageType<T>::type val, tmp_val;
121  QWidget *main_widget, *data_widget;
122  std::mutex mtx;
123  bool restart_after_change, has_changed, tmp_changed;
124 
125  void initMainWidget(QWidget *sub_widget);
126  void save(void);
127 };
128 
129 #endif // CONFIG_IMPL_DEV_H
virtual void * value(void)=0
Get the value of the config.
virtual void refresh(void)=0
Notify the item that the config value changed.
virtual QWidget * widget(void) const =0
Get a widget representing this config type.
Base class of ConfigImplDev that doesn&#39;t depend on the type of the config.
Definition: config_impl_base_dev.h:16
virtual bool changed(void)=0
Check if the config value changed.
virtual void load(void)=0
Load the value of this config from the settings scope.
virtual void lock(void)=0
Lock the mutex of the config.
Base class that binds RovizItem to the itemframework/Qt.
Definition: roviz_item_base_dev.h:25
Dev implementation of the config interface.
Definition: config_impl_dev.h:27
virtual void unlock(void)=0
Unlock the mutex of the config.