Falcon
Loading...
Searching...
No Matches
connections.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 <string>
23
24class PortAddress {
25 public:
26 PortAddress(std::string processor, std::string port)
27 : processor_name_(processor),
28 port_name_(port),
29 processor_class_("?"),
30 port_datatype_("?") {}
31
32 const std::string processor() const { return processor_name_; }
33 const std::string port() const { return port_name_; }
34
35 const std::string processor_class() const { return processor_class_; }
36 const std::string port_datatype() const { return port_datatype_; }
37
38 void set_port(std::string port, std::string port_datatype = "?") {
39 port_name_ = port;
40 port_datatype_ = port_datatype;
41 }
42
43 void set_port_datatype(std::string datatype) { port_datatype_ = datatype; }
44 void set_processor_class(std::string klass) { processor_class_ = klass; }
45 const std::string string(bool full = false) const;
46
47 protected:
48 std::string processor_name_;
49 std::string port_name_;
50 std::string processor_class_;
51 std::string port_datatype_;
52};
53
54class SlotAddress : public PortAddress {
55 public:
56 SlotAddress(std::string processor, std::string port, int slot)
57 : PortAddress(processor, port), slot_(slot) {}
58
59 SlotAddress(const PortAddress& port, int slot) : PortAddress(port), slot_(slot) {}
60
61 int slot() const { return slot_; }
62
63 void set_slot(int slot) { slot_ = slot; }
64
65 const std::string string(bool full = false) const;
66
67 protected:
68 int slot_;
69};