c,
98 | @SuppressWarnings("unused") Class pC) {
99 | return (Function
) javaTypeToGetter.get(c);
100 | }
101 |
102 |
103 |
104 |
105 |
106 | public final Class extends Parameter> parameterClass;
107 | private final String[] typeAttrValues;
108 |
109 | public String[] getTypeAttributesValues() {
110 | return Arrays.copyOf(typeAttrValues, typeAttrValues.length);
111 | }
112 |
113 | private Type(Class pC, String... attr) {
114 | parameterClass = pC;
115 | typeAttrValues = attr;
116 | }
117 |
118 |
119 | }
120 |
--------------------------------------------------------------------------------
/src/cpp/rapidxml-1.13/rapidxml_utils.hpp:
--------------------------------------------------------------------------------
1 | #ifndef RAPIDXML_UTILS_HPP_INCLUDED
2 | #define RAPIDXML_UTILS_HPP_INCLUDED
3 |
4 | // Copyright (C) 2006, 2009 Marcin Kalicinski
5 | // Version 1.13
6 | // Revision $DateTime: 2009/05/13 01:46:17 $
7 | //! \file rapidxml_utils.hpp This file contains high-level rapidxml utilities that can be useful
8 | //! in certain simple scenarios. They should probably not be used if maximizing performance is the main objective.
9 |
10 | #include "rapidxml.hpp"
11 | #include
12 | #include
13 | #include
14 | #include
15 |
16 | namespace rapidxml
17 | {
18 |
19 | //! Represents data loaded from a file
20 | template
21 | class file
22 | {
23 |
24 | public:
25 |
26 | //! Loads file into the memory. Data will be automatically destroyed by the destructor.
27 | //! \param filename Filename to load.
28 | file(const char *filename)
29 | {
30 | using namespace std;
31 |
32 | // Open stream
33 | basic_ifstream stream(filename, ios::binary);
34 | if (!stream)
35 | throw runtime_error(string("cannot open file ") + filename);
36 | stream.unsetf(ios::skipws);
37 |
38 | // Determine stream size
39 | stream.seekg(0, ios::end);
40 | size_t size = stream.tellg();
41 | stream.seekg(0);
42 |
43 | // Load data and add terminating 0
44 | m_data.resize(size + 1);
45 | stream.read(&m_data.front(), static_cast(size));
46 | m_data[size] = 0;
47 | }
48 |
49 | //! Loads file into the memory. Data will be automatically destroyed by the destructor
50 | //! \param stream Stream to load from
51 | file(std::basic_istream &stream)
52 | {
53 | using namespace std;
54 |
55 | // Load data and add terminating 0
56 | stream.unsetf(ios::skipws);
57 | m_data.assign(istreambuf_iterator(stream), istreambuf_iterator());
58 | if (stream.fail() || stream.bad())
59 | throw runtime_error("error reading stream");
60 | m_data.push_back(0);
61 | }
62 |
63 | //! Gets file data.
64 | //! \return Pointer to data of file.
65 | Ch *data()
66 | {
67 | return &m_data.front();
68 | }
69 |
70 | //! Gets file data.
71 | //! \return Pointer to data of file.
72 | const Ch *data() const
73 | {
74 | return &m_data.front();
75 | }
76 |
77 | //! Gets file data size.
78 | //! \return Size of file data, in characters.
79 | std::size_t size() const
80 | {
81 | return m_data.size();
82 | }
83 |
84 | private:
85 |
86 | std::vector m_data; // File data
87 |
88 | };
89 |
90 | //! Counts children of node. Time complexity is O(n).
91 | //! \return Number of children of node
92 | template
93 | inline std::size_t count_children(xml_node *node)
94 | {
95 | xml_node *child = node->first_node();
96 | std::size_t count = 0;
97 | while (child)
98 | {
99 | ++count;
100 | child = child->next_sibling();
101 | }
102 | return count;
103 | }
104 |
105 | //! Counts attributes of node. Time complexity is O(n).
106 | //! \return Number of attributes of node
107 | template
108 | inline std::size_t count_attributes(xml_node *node)
109 | {
110 | xml_attribute *attr = node->first_attribute();
111 | std::size_t count = 0;
112 | while (attr)
113 | {
114 | ++count;
115 | attr = attr->next_attribute();
116 | }
117 | return count;
118 | }
119 |
120 | }
121 |
122 | #endif
123 |
--------------------------------------------------------------------------------
/src/cpp/paramtuner.h:
--------------------------------------------------------------------------------
1 | /*
2 | * libParamTuner
3 | * Copyright (C) 2017 Marc Baloup, Veïs Oudjail
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 | #ifndef LIB_PARAM_TUNER_H
19 | #define LIB_PARAM_TUNER_H
20 |
21 | #include
22 |
23 | namespace ParamTuner {
24 |
25 | /**
26 | \brief Start listening modifications of the specified file.
27 |
28 | After this function call, when the specified file is modified
29 | by another program, the variables binded with lptBind() are updated
30 | to their new values from file.
31 |
32 | The specified file's content must be an XML file with a root node
33 | "ParamList". Direct child node of the ParamList node represent a
34 | parameter in your program, for example :
35 |
36 | See the documentation of lptBind() to see all possible types.
37 |
38 | If a node is not binded to a variable, a message will be sent to standard
39 | error stream. If a node has not a valid type or value, an error will be
40 | displayed too, and the variable will not be updated.
41 |
42 | When this function is called multiple times, the current call disable
43 | listener of the previous call.
44 |
45 | \param path the relative or absolute path to the file to listen to
46 |
47 | \param manualUpdate determine if parameters are updated using update() function
48 |
49 | \return -1 if a problem occurs when starting the listener, 0 otherwise.
50 | */
51 | int load(const std::string &path, bool manualUpdate=false);
52 |
53 |
54 | /**
55 | \brief Bind a variable with a parameter in the XML file.
56 |
57 | Theses type of variable are actually supported, with the corresponding
58 | type in XML file :
59 | * Integer type (C/C++ type `int`) : type="int".
60 | * Floating point type (C/C++ type `double`) : type="double".
61 | * Boolean type (C++ type `bool`) : type="bool".
62 | The variable in program will have the value true if and only if the value in
63 | XML file is equal, case ignored, to "true".
64 | * String type (c++ type 'std::string') : type="string".
65 |
66 | If a variable is binded to a parameter that doesn't have compatible
67 | type, bad values may be written to the variables.
68 |
69 | This function may be called before or after calling lptLoad().
70 | The internal storage of binded values is always preserved.
71 |
72 | If a variable is already binded with the specified name, the old
73 | binding will be erased.
74 |
75 | You must ensure that the memory at the address specified by ptr
76 | is always accessible during the program execution, to avoid
77 | segmentation fault.
78 |
79 | \param name the parameter name, that is equal to the node name
80 | containing the parameter value.
81 |
82 | \param ptr a pointer to the variable that will be updated when the
83 | file is modified.
84 | */
85 | void bind(const std::string &name, void *ptr);
86 |
87 | /**
88 | \brief Remove a binded variable
89 |
90 | \param name the parameter name
91 | */
92 | void unbind(const std::string &name);
93 |
94 | /**
95 | \brief Update all parameters in an explicit way when useUpdateFunc=true
96 |
97 | This function has no effect if useUpdateFunc=false
98 |
99 | If useUpdateFunc=true, the function reads the xml file only if it has changed
100 | and then updates all parameter values.
101 | */
102 | void update();
103 |
104 | }
105 | #endif
106 |
--------------------------------------------------------------------------------
/src/gui/src/main/java/fr/univ_lille1/libparamtuner/gui/parameters_panel/ParameterPanel.java:
--------------------------------------------------------------------------------
1 | /*
2 | * libParamTuner
3 | * Copyright (C) 2017 Marc Baloup, Veïs Oudjail
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 | package fr.univ_lille1.libparamtuner.gui.parameters_panel;
19 |
20 | import fr.univ_lille1.libparamtuner.gui.MainFrame;
21 | import fr.univ_lille1.libparamtuner.parameters.BooleanParameter;
22 | import fr.univ_lille1.libparamtuner.parameters.FloatParameter;
23 | import fr.univ_lille1.libparamtuner.parameters.IntegerParameter;
24 | import fr.univ_lille1.libparamtuner.parameters.Parameter;
25 | import fr.univ_lille1.libparamtuner.parameters.StringParameter;
26 | import javafx.geometry.Pos;
27 | import javafx.scene.Node;
28 | import javafx.scene.control.Label;
29 | import javafx.scene.control.Tooltip;
30 | import javafx.scene.layout.Background;
31 | import javafx.scene.layout.BackgroundFill;
32 | import javafx.scene.layout.Border;
33 | import javafx.scene.layout.BorderPane;
34 | import javafx.scene.layout.BorderStroke;
35 | import javafx.scene.layout.BorderWidths;
36 | import javafx.scene.layout.HBox;
37 | import javafx.scene.paint.Color;
38 | import javafx.scene.text.Font;
39 | import javafx.scene.text.FontPosture;
40 |
41 | public abstract class ParameterPanel extends BorderPane {
42 |
43 | protected final MainFrame frame;
44 | protected final Parameter parameter;
45 | protected final HBox panel;
46 |
47 | public ParameterPanel(MainFrame f, int index, Parameter p) {
48 | frame = f;
49 | parameter = p;
50 |
51 | panel = new HBox(3);
52 | setCenter(panel);
53 |
54 | setBackground(new Background(new BackgroundFill((index % 2 == 0) ? Color.rgb(220, 220, 220) : Color.TRANSPARENT, null, null)));
55 | setBorder(new Border(new BorderStroke(Color.TRANSPARENT, null, null, new BorderWidths(2))));
56 | panel.setAlignment(Pos.CENTER_LEFT);
57 |
58 | Label l = new Label(p.name);
59 | l.setTooltip(new Tooltip(p.name + " of type " + p.getType().name()));
60 |
61 |
62 | // the minWidth property of the label is bounded to the global "minWidth" property.
63 | l.minWidthProperty().bind(f.minLabelSize);
64 |
65 | // listener that update the global "minWidth" property if the current label is larger
66 | // so other labels will have the same "minWidth".
67 | l.widthProperty().addListener((o, old, newValue) -> {
68 | if ((Double)newValue > f.minLabelSize.doubleValue()) {
69 | f.minLabelSize.setValue(newValue);
70 | }
71 | });
72 |
73 |
74 |
75 | add(l);
76 |
77 |
78 | if (!p.getDesc().isEmpty()) {
79 | Label descL = new Label(p.getDesc());
80 | descL.setBorder(new Border(new BorderStroke(Color.TRANSPARENT, null, null, new BorderWidths(2, 10, 0, 10))));
81 | descL.setWrapText(true);
82 | descL.setFont(Font.font(Font.getDefault().getFamily(), FontPosture.ITALIC, Font.getDefault().getSize()));
83 | setBottom(descL);
84 | }
85 |
86 |
87 | }
88 |
89 |
90 |
91 | protected void add(Node e) {
92 | panel.getChildren().add(e);
93 | }
94 |
95 |
96 | public void notifyContentModification() {
97 | frame.onContentModify();
98 | }
99 |
100 |
101 |
102 | public static ParameterPanel fromParameter(MainFrame f, int index, Parameter p) {
103 | if (p instanceof BooleanParameter) {
104 | return new BooleanParameterPanel(f, index, (BooleanParameter) p);
105 | }
106 | if (p instanceof FloatParameter) {
107 | return new FloatParameterPanel(f, index, (FloatParameter) p);
108 | }
109 | if (p instanceof IntegerParameter) {
110 | return new IntegerParameterPanel(f, index, (IntegerParameter) p);
111 | }
112 | if (p instanceof StringParameter) {
113 | return new StringParameterPanel(f, index, (StringParameter) p);
114 | }
115 |
116 | throw new IllegalArgumentException("Unsupported Parameter type : " + p.getClass().getName());
117 | }
118 |
119 |
120 | }
121 |
--------------------------------------------------------------------------------
/src/java/src/main/java/fr/univ_lille1/libparamtuner/parameters/Parameter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * libParamTuner
3 | * Copyright (C) 2017 Marc Baloup, Veïs Oudjail
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 | package fr.univ_lille1.libparamtuner.parameters;
19 |
20 | import org.w3c.dom.Document;
21 | import org.w3c.dom.Element;
22 |
23 | public abstract class Parameter {
24 |
25 | public final String name;
26 | protected String value;
27 | protected double min;
28 | protected double max;
29 | protected String desc = null;
30 |
31 | protected Parameter(String n, String v, double m, double M) {
32 | name = n;
33 | value = v;
34 | setMinMax(m, M);
35 | }
36 |
37 | protected Parameter(String n, String v) {
38 | this(n, v, 0, 0);
39 | }
40 |
41 | protected Parameter(String n) {
42 | this(n, "", 0, 0);
43 | }
44 |
45 | protected Parameter(String n, double m, double M) {
46 | this(n, "", m, M);
47 | }
48 |
49 | public String getStringValue() {
50 | return value;
51 | }
52 |
53 | public Type getType() {
54 | return Type.getTypeFromParamInstance(getClass());
55 | }
56 |
57 | public double getMin() {
58 | return min;
59 | }
60 |
61 | public double getMax() {
62 | return max;
63 | }
64 |
65 | public void setMinMax(double m, double M) {
66 | if (m > M) {
67 | min = M;
68 | max = m;
69 | }
70 | else {
71 | min = m;
72 | max = M;
73 | }
74 | }
75 |
76 | public void setDesc(String d) {
77 | if (d == null)
78 | d = "";
79 | desc = d;
80 | }
81 |
82 | public String getDesc() {
83 | return desc;
84 | }
85 |
86 |
87 |
88 | /* package */ Parameter(Element xmlEl) {
89 | name = xmlEl.getTagName();
90 | value = xmlEl.getAttribute("value");
91 |
92 | double m, M;
93 |
94 | try {
95 | m = Double.parseDouble(xmlEl.getAttribute("min"));
96 | } catch (NumberFormatException e) {
97 | m = 0;
98 | }
99 | try {
100 | M = Double.parseDouble(xmlEl.getAttribute("max"));
101 | } catch (NumberFormatException e) {
102 | M = 0;
103 | }
104 | setMinMax(m, M);
105 |
106 | setDesc(xmlEl.getAttribute("desc"));
107 | }
108 |
109 |
110 | /* package */ Element toXMLElement(Document doc) {
111 | Element el = doc.createElement(name);
112 | el.setAttribute("type", getType().getTypeAttributesValues()[0]);
113 | if (min != 0 || max != 0) {
114 | boolean isInteger = getClass() == IntegerParameter.class;
115 | el.setAttribute("min", isInteger ? ""+(int)min : ""+min);
116 | el.setAttribute("max", isInteger ? ""+(int)max : ""+max);
117 | }
118 | el.setAttribute("value", value);
119 | if (!desc.isEmpty())
120 | el.setAttribute("desc", desc);
121 | return el;
122 | }
123 |
124 |
125 |
126 |
127 | /**
128 | * @deprecated Prefer using {@link #toXMLElement(Document)} because it is more flexible
129 | * and allow more clean code when overriding. For the current method, overriding it
130 | * requires to reimplement the code to add specific functionnality related to the subclass
131 | */
132 | @Deprecated
133 | /* package */ String toXMLstring() {
134 | String res = "<";
135 | res += name + " type=\"";
136 |
137 | String type = Type.getStrTypeFromParamInstance(getClass());
138 | res+= type + "\" ";
139 |
140 | if (min != 0 || max != 0) {
141 | if (getClass() == IntegerParameter.class) {
142 | res += "min=\"" + (int)min + "\" ";
143 | res += "max=\"" + (int)max + "\" ";
144 | } else {
145 | res += "min=\"" + min + "\" ";
146 | res += "max=\"" + max + "\" ";
147 | }
148 | }
149 |
150 | res += "value=\"" + value + "\"/>";
151 |
152 | return res;
153 | }
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 | /* package */ static Parameter fromXMLElement(Element el) throws Exception {
162 | Type type = Type.getType(el.getAttribute("type"));
163 |
164 | if (type == null)
165 | throw new IllegalArgumentException("Element has not a valid type attribute : '" + type + "'");
166 |
167 | return type.parameterClass.getDeclaredConstructor(Element.class).newInstance(el);
168 |
169 | }
170 |
171 | }
172 |
--------------------------------------------------------------------------------
/src/cpp/rapidxml-1.13/rapidxml_iterators.hpp:
--------------------------------------------------------------------------------
1 | #ifndef RAPIDXML_ITERATORS_HPP_INCLUDED
2 | #define RAPIDXML_ITERATORS_HPP_INCLUDED
3 |
4 | // Copyright (C) 2006, 2009 Marcin Kalicinski
5 | // Version 1.13
6 | // Revision $DateTime: 2009/05/13 01:46:17 $
7 | //! \file rapidxml_iterators.hpp This file contains rapidxml iterators
8 |
9 | #include "rapidxml.hpp"
10 |
11 | namespace rapidxml
12 | {
13 |
14 | //! Iterator of child nodes of xml_node
15 | template
16 | class node_iterator
17 | {
18 |
19 | public:
20 |
21 | typedef typename xml_node value_type;
22 | typedef typename xml_node &reference;
23 | typedef typename xml_node *pointer;
24 | typedef std::ptrdiff_t difference_type;
25 | typedef std::bidirectional_iterator_tag iterator_category;
26 |
27 | node_iterator()
28 | : m_node(0)
29 | {
30 | }
31 |
32 | node_iterator(xml_node *node)
33 | : m_node(node->first_node())
34 | {
35 | }
36 |
37 | reference operator *() const
38 | {
39 | assert(m_node);
40 | return *m_node;
41 | }
42 |
43 | pointer operator->() const
44 | {
45 | assert(m_node);
46 | return m_node;
47 | }
48 |
49 | node_iterator& operator++()
50 | {
51 | assert(m_node);
52 | m_node = m_node->next_sibling();
53 | return *this;
54 | }
55 |
56 | node_iterator operator++(int)
57 | {
58 | node_iterator tmp = *this;
59 | ++this;
60 | return tmp;
61 | }
62 |
63 | node_iterator& operator--()
64 | {
65 | assert(m_node && m_node->previous_sibling());
66 | m_node = m_node->previous_sibling();
67 | return *this;
68 | }
69 |
70 | node_iterator operator--(int)
71 | {
72 | node_iterator tmp = *this;
73 | ++this;
74 | return tmp;
75 | }
76 |
77 | bool operator ==(const node_iterator &rhs)
78 | {
79 | return m_node == rhs.m_node;
80 | }
81 |
82 | bool operator !=(const node_iterator &rhs)
83 | {
84 | return m_node != rhs.m_node;
85 | }
86 |
87 | private:
88 |
89 | xml_node *m_node;
90 |
91 | };
92 |
93 | //! Iterator of child attributes of xml_node
94 | template
95 | class attribute_iterator
96 | {
97 |
98 | public:
99 |
100 | typedef typename xml_attribute value_type;
101 | typedef typename xml_attribute &reference;
102 | typedef typename xml_attribute *pointer;
103 | typedef std::ptrdiff_t difference_type;
104 | typedef std::bidirectional_iterator_tag iterator_category;
105 |
106 | attribute_iterator()
107 | : m_attribute(0)
108 | {
109 | }
110 |
111 | attribute_iterator(xml_node *node)
112 | : m_attribute(node->first_attribute())
113 | {
114 | }
115 |
116 | reference operator *() const
117 | {
118 | assert(m_attribute);
119 | return *m_attribute;
120 | }
121 |
122 | pointer operator->() const
123 | {
124 | assert(m_attribute);
125 | return m_attribute;
126 | }
127 |
128 | attribute_iterator& operator++()
129 | {
130 | assert(m_attribute);
131 | m_attribute = m_attribute->next_attribute();
132 | return *this;
133 | }
134 |
135 | attribute_iterator operator++(int)
136 | {
137 | attribute_iterator tmp = *this;
138 | ++this;
139 | return tmp;
140 | }
141 |
142 | attribute_iterator& operator--()
143 | {
144 | assert(m_attribute && m_attribute->previous_attribute());
145 | m_attribute = m_attribute->previous_attribute();
146 | return *this;
147 | }
148 |
149 | attribute_iterator operator--(int)
150 | {
151 | attribute_iterator tmp = *this;
152 | ++this;
153 | return tmp;
154 | }
155 |
156 | bool operator ==(const attribute_iterator &rhs)
157 | {
158 | return m_attribute == rhs.m_attribute;
159 | }
160 |
161 | bool operator !=(const attribute_iterator &rhs)
162 | {
163 | return m_attribute != rhs.m_attribute;
164 | }
165 |
166 | private:
167 |
168 | xml_attribute *m_attribute;
169 |
170 | };
171 |
172 | }
173 |
174 | #endif
175 |
--------------------------------------------------------------------------------
/Readme.md:
--------------------------------------------------------------------------------
1 | # libParamTuner
2 |
3 | Cross-platform library to ease the interactive tuning of parameters at run time and without the need to recompile code.
4 |
5 | ## Install on macOS using Homebrew
6 |
7 | Run ```brew install casiez/libparamtuner/libparamtuner```
8 |
9 | ## Minimal example
10 | ```cpp
11 | #include
12 | #include
13 | #include "paramtuner.h"
14 |
15 | #ifdef _WIN32
16 | # include
17 | # define SLEEP(ms) (Sleep(ms))
18 | #else
19 | # include
20 | # define SLEEP(ms) (usleep(ms * 1000))
21 | #endif
22 |
23 | using namespace std;
24 |
25 | int main() {
26 | double varDouble = 2.0;
27 | int varInt = 1;
28 | bool varBool = false;
29 | string varString;
30 |
31 | ParamTuner::load("settings.xml");
32 | // Use the line below if you want to explicitly update
33 | // all parameters using update() function
34 | // ParamTuner::load("settings.xml", true);
35 | ParamTuner::bind("setting1", &varDouble);
36 | ParamTuner::bind("setting2", &varInt);
37 | ParamTuner::bind("mybool", &varBool);
38 | ParamTuner::bind("mystring", &varString);
39 |
40 | while (true) {
41 | SLEEP(500); // 500 ms
42 | // Uncomment the line below if you use ParamTuner::load("settings.xml", true);
43 | // ParamTuner::update();
44 | cout << "setting1 (double) = " << varDouble
45 | << " ; setting2 (int) = " << varInt
46 | << " ; mybool (bool) = " << varBool
47 | << " ; mystring (string) = " << varString
48 | << endl;
49 | }
50 | }
51 | ```
52 |
53 | The associated settings.xml file is as follows:
54 |
55 | ```
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 | ```
64 |
65 | ## C++ Library
66 |
67 | The C++ libParamTuner library use system-dependent libraries
68 | that are already installed in their respective OS :
69 | * Windows ([FindFirstChangeNotification() function](https://msdn.microsoft.com/en-us/library/aa364417%28VS.85%29.aspx))
70 | * Linux (kernel > 2.6.13, with [Inotify](https://en.wikipedia.org/wiki/Inotify))
71 | * Mac OS X (version > 10.5, with [FSEvents](https://developer.apple.com/library/content/documentation/Darwin/Conceptual/FSEvents_ProgGuide/Introduction/Introduction.html))
72 |
73 | ### Compilation
74 |
75 | * In directory `src/cpp`, run `make`
76 | * Library file : `libparamtuner.a`
77 | * Header file : `paramtuner.h`
78 |
79 | ### Usage and documentation
80 |
81 | Read detailed documentation in the header file `paramtuner.h`
82 |
83 | ### Example files
84 |
85 | Some examples files are available in `examples/cpp` directory.
86 | You can compile them with `make [C++ filename without extension]` command.
87 |
88 |
89 |
90 | ## Java 8+ Library
91 |
92 | ### Compilation and installation
93 |
94 | The Java library use Maven. In directory `src/java`, run `mvn clean install`.
95 | This command will create a libParamTuner.jar in the `target` subdirectory.
96 | Also, it will install it into your local maven repository, so you can use
97 | it in an other Maven project.
98 |
99 | To use it in a Maven project, add theses lines in your POM's
100 | `` section :
101 | ```
102 |
103 | fr.univ_lille1.libparamtuner
104 | libParamTuner
105 | 0.0.1-SNAPSHOT
106 |
107 | ```
108 |
109 | If you have a non-Maven project, just add `libParamTuner.jar` to the
110 | build path of your project.
111 |
112 | To get the javadoc, run `mvn javadoc:javadoc` , then go to the subdirectory
113 | `target/site/apidocs`
114 |
115 |
116 |
117 | ## ParamTuner GUI
118 |
119 | This JavaFX interface allow developers to change value in
120 | real-time without having to edit the settings file manually.
121 |
122 | ### Available binaries
123 | See the [releases](https://github.com/casiez/libparamtuner/releases) section to directly download a binary version.
124 |
125 | ### Compilation
126 |
127 | The Java application use Maven. First, you have to compile the Java library
128 | (see instruction above). Then, in directory `src/gui`, run `mvn package`.
129 | The executable Jar is in subdirectory `target`.
130 |
131 | If you want to create an installer with an executable, run `mvn jfx:native`. Note that icns icons for macOS were created using the command `makeicns -in ParamTunerGUI.png -out ParamTunerGUI.icns`
132 |
133 | ### Usage
134 |
135 | java -jar ParamTunerGUI.jar path/to/settings.xml
136 |
137 | or
138 |
139 | java -jar ParamTunerGUI.jar
140 |
141 | then you can put the path to the XML directly into the GUI.
142 |
143 | ## More information
144 |
145 | libParamTuner has been presented as a demo during the [IHM'17 conference](http://ihm17.afihm.org/).
146 | More information (in French) available on [HAL](https://hal.archives-ouvertes.fr/hal-01577686).
147 |
--------------------------------------------------------------------------------
/src/cpp/paramtuner.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * libParamTuner
3 | * Copyright (C) 2017 Marc Baloup, Veïs Oudjail
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 | #include "paramtuner.h"
19 |
20 | #include "FileSystemWatcher.hpp"
21 | #include "rapidxml-1.13/rapidxml.hpp"
22 |
23 | #include