40 lines
889 B
C++
40 lines
889 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>
|
|
|
|
class OperationStorage
|
|
{
|
|
public:
|
|
struct Log
|
|
{
|
|
std::string operation;
|
|
unsigned int line;
|
|
std::string operand_lhs;
|
|
std::string operand_rhs;
|
|
std::string operand_result;
|
|
};
|
|
|
|
OperationStorage() = delete;
|
|
OperationStorage(const OperationStorage&) = delete;
|
|
|
|
explicit OperationStorage(const std::string& output_filename);
|
|
~OperationStorage();
|
|
|
|
void pushOperation(const std::string& filename, const Log& op);
|
|
[[nodiscard]] const std::unordered_map<std::string, std::vector<Log>>& getOperations() const;
|
|
private:
|
|
std::unordered_map<std::string, std::vector<Log>> _operations;
|
|
std::string _output_filename;
|
|
|
|
void _dumpToFile();
|
|
};
|
|
|
|
#endif //C_ANALYZER_OPERATIONSTORAGE_HPP
|