aboutsummaryrefslogtreecommitdiff
path: root/src/tracking/change_tracker.h
blob: 05f40211c8a59645bde6d1dd3a9cf983ea15ce02 (plain)
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
#ifndef CHANGE_SRC_TRACKING_CHANGE_TRACKER_H_
#define CHANGE_SRC_TRACKING_CHANGE_TRACKER_H_

#include <mutex>
#include <sstream>
#include <unordered_map>

#include "utility/logger.h"

namespace tracking {

class ChangeTracker {
	public:
		ChangeTracker(utility::Logger*, const std::string&);
		ChangeTracker(utility::Logger*);
		~ChangeTracker();

		bool is_tracked(const std::string&) const;

		bool track(const std::string&);

	private:
		const std::string      diff_cmd_;
		utility::Logger* const logger_;
		std::mutex             write_mutex_;

		std::unordered_map<
			std::string, std::unique_ptr<std::stringstream>
		> children_;

};

}

#endif  // CHANGE_SRC_TRACKING_CHANGE_TRACKER_H_