Falcon
Toggle main menu visibility
Loading...
Searching...
No Matches
datastreamer.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 <arpa/inet.h>
23
#include <netinet/in.h>
24
25
#include <chrono>
26
#include <string>
27
#include <thread>
28
29
#include "datasource.hpp"
30
31
void
busysleep_until(std::chrono::time_point<std::chrono::high_resolution_clock> t);
32
33
class
DataStreamer {
34
public
:
35
DataStreamer(
DataSource
* source,
double
rate, std::string ip,
int
port, uint64_t npackets);
36
~DataStreamer();
37
38
bool
running()
const
;
39
bool
terminated()
const
;
40
void
Terminate();
41
42
void
Run();
43
void
Start();
44
void
Stop();
45
46
void
set_source(
DataSource
* source);
47
48
protected
:
49
std::thread thread_;
50
bool
running_ =
false
;
51
bool
terminate_ =
false
;
52
53
DataSource
* source_;
54
double
rate_;
55
std::string ip_;
56
int
port_;
57
uint64_t max_packets_;
58
59
struct
sockaddr_in server_address_;
60
int
udp_socket_;
61
};
DataSource
Definition
datasource.hpp:29
extensions
falcon-fklab-extensions
tools
nlxtestbench
datastreamer.hpp
Generated by
1.18.0