SysfsSensorBase.h 1.15 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
 * SysfsSensorBase.h
 *
 *  Created on: 13.08.2018
 *      Author: Micha Mueller
 */

#ifndef SYSFS_SYSFSSENSORBASE_H_
#define SYSFS_SYSFSSENSORBASE_H_

#include "../../headers/SensorBase.h"

#include <regex>

class SysfsSensorBase : virtual public SensorBase {
public:
	SysfsSensorBase(const std::string& name) :
		SensorBase(name),
		_path(""),
		_filter(false),
		_substitution("") {
		_file = NULL;
		//_regx = "";
	}

	virtual ~SysfsSensorBase() {}

	const std::string&	getPath()	const { return _path; }
	FILE* 				getFile()	const { return _file; }
	bool 				hasFilter()	const { return _filter; }
	std::regex			getRegex()	const { return _regx;	}
	const std::string&	getSubstitution()	const { return _substitution; }

	void setPath(const std::string& path)	{ _path = path; }
	void setFile(FILE* file)				{ _file = file; }
	void setFilter(bool filter)				{ _filter = filter; }
	void setRegex(std::regex regx)			{ _regx = regx; }
	void setSubstitution(const std::string& substitution)	{ _substitution = substitution; }

protected:
	std::string _path;
	FILE* _file;
	bool _filter;
	std::regex _regx;
	std::string _substitution;

};

#endif /* SYSFS_SYSFSSENSORBASE_H_ */