blob: 262b03713678fae8aa0e55fa19cae859420a22ef [file] [log] [blame]
Václav Kubernát96344a12018-05-28 16:33:39 +02001/*
2 * Copyright (C) 2018 CESNET, https://photonics.cesnet.cz/
3 * Copyright (C) 2018 FIT CVUT, https://fit.cvut.cz/
4 *
5 * Written by Václav Kubernát <kubervac@fit.cvut.cz>
6 *
7*/
8
9#pragma once
10
11#include <boost/variant/static_visitor.hpp>
Václav Kubernát6415b822018-08-22 17:40:01 +020012#include "datastore_access.hpp"
Václav Kubernát812ee282018-08-30 17:10:03 +020013#include "parser.hpp"
Václav Kubernát96344a12018-05-28 16:33:39 +020014
15struct Interpreter : boost::static_visitor<void> {
Václav Kubernát6415b822018-08-22 17:40:01 +020016 Interpreter(Parser& parser, DatastoreAccess& datastore);
Václav Kubernát96344a12018-05-28 16:33:39 +020017
Václav Kubernát812ee282018-08-30 17:10:03 +020018 void operator()(const commit_&) const;
Václav Kubernát07204242018-06-04 18:12:09 +020019 void operator()(const set_&) const;
Václav Kubernátb6ff0b62018-08-30 16:14:53 +020020 void operator()(const get_&) const;
Václav Kubernát96344a12018-05-28 16:33:39 +020021 void operator()(const cd_&) const;
Václav Kubernátb61336d2018-05-28 17:35:03 +020022 void operator()(const create_&) const;
23 void operator()(const delete_&) const;
Václav Kubernát11afac72018-07-18 14:59:53 +020024 void operator()(const ls_&) const;
Václav Kubernátb61336d2018-05-28 17:35:03 +020025
Václav Kubernát96344a12018-05-28 16:33:39 +020026private:
Václav Kubernát6415b822018-08-22 17:40:01 +020027 template <typename T>
28 std::string absolutePathFromCommand(const T& command) const;
Václav Kubernátb6ff0b62018-08-30 16:14:53 +020029 std::string absolutePathFromCommand(const get_& command) const;
Václav Kubernát6415b822018-08-22 17:40:01 +020030
Václav Kubernát96344a12018-05-28 16:33:39 +020031 Parser& m_parser;
Václav Kubernát6415b822018-08-22 17:40:01 +020032 DatastoreAccess& m_datastore;
Václav Kubernát96344a12018-05-28 16:33:39 +020033};