PDUConfigurator.h 1.41 KB
Newer Older
1
2
3
4
5
6
7
/*
 * PDUConfigurator.h
 *
 *  Created on: 24.02.2018
 *      Author: Micha Mueller
 */

8
9
10
#ifndef SRC_SENSORS_PDU_PDUCONFIGURATOR_H_
#define SRC_SENSORS_PDU_PDUCONFIGURATOR_H_

11
12
#include "PDUUnit.h"
#include <list>
13

14
#include "../../ConfiguratorTemplate.h"
15
#include "PDUSingleSensor.h"
16

17
class PDUConfigurator: public ConfiguratorTemplate<PDUSensorBase, PDUSingleSensor> {
18

19
	typedef std::list<PDUUnit> pduList_t;
20
21
22
23
24
25

public:

	PDUConfigurator();
	virtual ~PDUConfigurator();

26
27
protected:
	bool derivedReadConfig(boost::property_tree::iptree& cfg) override;
Micha Mueller's avatar
Micha Mueller committed
28
	void derivedReReadConfig() override { _pdus.clear(); }
29
30
	void derivedSetGlobalSettings(const pluginSettings_t& pluginSettings) override { /*nothing to overwrite*/ }
	bool derivedReadSensorBase(PDUSensorBase& sensor, boost::property_tree::iptree& config) override;
31

32
private:
33
34
35
36
37
38
	/**
	 * Split the given string into multiple parts which are later required to find the sensor value in the boost property tree.
	 * Store the individual parts into the sensors _xmlPathVector
	 * @param sensor		Sensor where the path belongs to
	 * @param pathString	Complete unrefined string as read from the config file
	 */
39
	void parsePathString(PDUSensorBase& sensor, const std::string& pathString);
40

41
	pduList_t				_pdus;
42
43
};

44
extern "C" ConfiguratorInterface* create() {
45
46
47
	return new PDUConfigurator;
}

48
extern "C" void destroy(ConfiguratorInterface* c) {
49
50
51
52
	delete c;
}

#endif /* SRC_SENSORS_PDU_PDUCONFIGURATOR_H_ */