masters-thesis/op-finder-lib/include/OperationStorage.hpp
Erki df8e5c5d09
All checks were successful
continuous-integration/drone/push Build is passing
Add unit testing for expected output
2021-03-10 01:12:47 +02:00

37 lines
923 B
C++

//
// Created by erki on 28.02.21.
//
#ifndef C_ANALYZER_OPERATIONSTORAGE_HPP
#define C_ANALYZER_OPERATIONSTORAGE_HPP
#include <string>
#include <unordered_map>
#include <vector>
#include "OperationLog.hpp"
class OperationStorage : public IOperationOutput
{
public:
OperationStorage() = default;
OperationStorage(const OperationStorage&) = delete;
~OperationStorage() override;
void enablePrettyPrint();
void toStream(std::ostream& stream);
void toFile(const std::string& output_filename);
void pushOperation(const std::string& original_filename, OperationLog&& op) override;
[[nodiscard]] const std::unordered_map<std::string, std::vector<OperationLog>>& getOperations() const;
private:
std::unordered_map<std::string, std::vector<OperationLog>> _operations;
bool _pretty_print = false;
std::string _convertFilepath(const std::string& original);
};
#endif //C_ANALYZER_OPERATIONSTORAGE_HPP