syncinterfacecommandtranslator.h 3.31 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/** @file
 * This file is part of the SpaceCreator.
 *
 * @copyright (C) 2021 N7 Space Sp. z o.o.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public License
 * along with this program. If not, see <https://www.gnu.org/licenses/lgpl-2.1.html>.
 */

20
21
#pragma once

22
23
#include "specialized/interfacecommandtranslator.h"

Filip Demski's avatar
Filip Demski committed
24
#include <shared/parameter.h>
25
26
27
28
29

namespace seds::model {
class CommandArgument;
enum class ArgumentsCombination : uint8_t;
} // namespace seds::model
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63

namespace conversion::iv::translator {

/**
 * @brief   Translator from SEDS sync interface command to InterfaceView interface
 */
class SyncInterfaceCommandTranslator final : public InterfaceCommandTranslator
{
public:
    /**
     * @brief   Constructor
     *
     * @param   ivFunction      Output interface view function
     * @param   interface       Parent interface
     */
    SyncInterfaceCommandTranslator(const seds::model::Interface &interface, ivm::IVFunction *ivFunction);
    /**
     * @brief   Deleted copy constructor
     */
    SyncInterfaceCommandTranslator(const SyncInterfaceCommandTranslator &) = delete;
    /**
     * @brief   Deleted move constructor
     */
    SyncInterfaceCommandTranslator(SyncInterfaceCommandTranslator &&) = delete;
    /**
     * @brief   Deleted copy assignment operator
     */
    SyncInterfaceCommandTranslator &operator=(const SyncInterfaceCommandTranslator &) = delete;
    /**
     * @brief   Deleted move assignment operator
     */
    SyncInterfaceCommandTranslator &operator=(SyncInterfaceCommandTranslator &&) = delete;

public:
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
    /**
     * @brief   Translates SEDS interface command to interface view interface
     *
     * This inserts result IV interface into member IV function
     *
     * @param   command         SEDS interface command
     * @param   interfaceType   Interface type
     */
    virtual auto translateCommand(const seds::model::InterfaceCommand &command,
            ivm::IVInterface::InterfaceType interfaceType) -> void override;

private:
    /**
     * @brief   Translates arguments of a SEDS interface command
     *
     * @param   arguments       Arguments to translate
     * @param   ivInterface     Output interface view interface
     */
    auto translateArguments(const std::vector<seds::model::CommandArgument> &arguments, ivm::IVInterface *ivInterface)
83
            -> void;
84
85
86
87
88
89
90
91
92
93
94

    /**
     * @brief   Creates interface view interface parameter
     *
     * @param   name        Name of the parameter
     * @param   typeName    Name of the type
     * @param   direction   Parameter direction
     *
     * @return  Interface view interface parameter
     */
    auto createIvInterfaceParameter(const QString &name, const QString &typeName,
Filip Demski's avatar
Filip Demski committed
95
            shared::InterfaceParameter::Direction direction) -> shared::InterfaceParameter;
96
97
98
};

} // namespace conversion::iv::translator