Falcon
Toggle main menu visibility
Loading...
Searching...
No Matches
commandsource.hpp
1
// ---------------------------------------------------------------------
2
// This file is part of falcon-core.
3
//
4
// Copyright (C) 2015, 2016, 2017 Neuro-Electronics Research Flanders
5
//
6
// Falcon-server is free software: you can redistribute it and/or modify
7
// it under the terms of the GNU General Public License as published by
8
// the Free Software Foundation, either version 3 of the License, or
9
// (at your option) any later version.
10
//
11
// Falcon-server is distributed in the hope that it will be useful,
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
// GNU General Public License for more details.
15
//
16
// You should have received a copy of the GNU General Public License
17
// along with falcon-core. If not, see <http://www.gnu.org/licenses/>.
18
// ---------------------------------------------------------------------
19
20
#pragma once
21
22
#include <cstring>
23
#include <deque>
24
#include <string>
25
#include <zmq.hpp>
26
#include "utilities/keyboard.hpp"
27
28
namespace
commands {
29
30
class
CommandSource
{
31
public
:
32
virtual
bool
getcommand(std::deque<std::string>& command) {
return
false
; }
33
virtual
bool
sendreply(
const
std::deque<std::string>& command, std::deque<std::string>& reply) {
34
return
false
;
35
}
36
};
37
38
class
CommandLineCommands
:
public
CommandSource
{
39
public
:
40
void
AddCommand(
const
std::deque<std::string>& command);
41
bool
getcommand(std::deque<std::string>& command);
42
bool
sendreply(
const
std::deque<std::string>& command, std::deque<std::string>& reply);
43
44
protected
:
45
std::deque<std::deque<std::string>> queued_commands_;
46
};
47
48
class
KeyboardCommands :
public
CommandSource
{
49
public
:
50
KeyboardCommands();
51
~KeyboardCommands();
52
53
bool
getcommand(std::deque<std::string>& command);
54
bool
sendreply(
const
std::deque<std::string>& command, std::deque<std::string>& reply);
55
};
56
57
class
ZMQCommands :
public
CommandSource
{
58
public
:
59
zmq::socket_t* socket;
60
61
ZMQCommands(zmq::context_t& context,
int
port);
62
~ZMQCommands();
63
64
bool
getcommand(std::deque<std::string>& command);
65
bool
sendreply(
const
std::deque<std::string>& command, std::deque<std::string>& reply);
66
};
67
}
// namespace commands
commands::CommandLineCommands
Definition
commandsource.hpp:38
commands::CommandSource
Definition
commandsource.hpp:30
falcon
commandsource.hpp
Generated by
1.18.0