riCOM_cpp
This repository contains the C++ implementation of the riCOM (Real Time Centre Of Mass) algorithm for 4D Scanning electron microscopy.
Main Page
Namespaces
Namespace List
Namespace Members
All
Functions
Variables
Enumerations
Enumerator
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
a
b
c
d
e
f
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
~
Functions
a
b
c
d
f
i
j
m
o
p
r
s
u
w
~
Variables
b
c
d
e
f
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
Files
File List
File Members
All
_
b
c
f
g
i
l
m
o
p
r
s
t
u
v
Functions
Typedefs
Enumerations
Macros
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Pages
src
SocketConnector.h
Go to the documentation of this file.
1
/* Copyright (C) 2021 Thomas Friedrich, Chu-Ping Yu,
2
* University of Antwerp - All Rights Reserved.
3
* You may use, distribute and modify
4
* this code under the terms of the GPL3 license.
5
* You should have received a copy of the GPL3 license with
6
* this file. If not, please visit:
7
* https://www.gnu.org/licenses/gpl-3.0.en.html
8
*
9
* Authors:
10
* Thomas Friedrich <thomas.friedrich@uantwerpen.be>
11
* Chu-Ping Yu <chu-ping.yu@uantwerpen.be>
12
*/
13
14
#ifndef SOCKET_CONNECTOR_H
15
#define SOCKET_CONNECTOR_H
16
17
#ifdef _WIN32
18
#pragma comment(lib, "ws2_32.lib"
)
19
#define _WINSOCK_DEPRECATED_NO_WARNINGS
20
#include <winsock2.h>
21
#include <ws2tcpip.h>
22
#include <io.h>
23
#else
24
#include <arpa/inet.h>
25
#include <unistd.h>
26
#include <cerrno>
27
#include <cstring>
28
#define SOCKET int
29
#define SOCKET_ERROR -1
30
#define INVALID_SOCKET -1
31
#endif
32
33
#include <string>
34
#include <iostream>
35
36
class
SocketConnector
37
{
38
public
:
39
SOCKET
rc_socket
;
40
41
bool
b_connected
;
42
std::string
ip
;
43
int
port
;
44
45
std::string
connection_information
;
46
int
read_data
(
char
*buffer,
int
data_size);
47
void
flush_socket
();
48
void
connect_socket
();
49
void
close_socket
();
50
SocketConnector
() :
rc_socket
(
INVALID_SOCKET
),
51
b_connected
(false),
52
ip
(
"127.0.0.1"
),
53
port
(6342){};
54
55
private
:
56
struct
sockaddr_in address;
57
#ifdef WIN32
58
WSADATA w;
59
const
char
opt = 1;
60
#else
61
int
opt = 1;
62
#endif
63
void
handle_socket_errors(
const
std::string &raised_at);
64
};
65
#endif
// SOCKET_CONNECTOR_H
INVALID_SOCKET
#define INVALID_SOCKET
Definition:
SocketConnector.h:30
SOCKET
#define SOCKET
Definition:
SocketConnector.h:28
SocketConnector
Definition:
SocketConnector.h:37
SocketConnector::rc_socket
SOCKET rc_socket
Definition:
SocketConnector.h:39
SocketConnector::b_connected
bool b_connected
Definition:
SocketConnector.h:41
SocketConnector::close_socket
void close_socket()
Definition:
SocketConnector.cpp:137
SocketConnector::connection_information
std::string connection_information
Definition:
SocketConnector.h:45
SocketConnector::port
int port
Definition:
SocketConnector.h:43
SocketConnector::flush_socket
void flush_socket()
Definition:
SocketConnector.cpp:42
SocketConnector::ip
std::string ip
Definition:
SocketConnector.h:42
SocketConnector::read_data
int read_data(char *buffer, int data_size)
Definition:
SocketConnector.cpp:16
SocketConnector::connect_socket
void connect_socket()
Definition:
SocketConnector.cpp:63
SocketConnector::SocketConnector
SocketConnector()
Definition:
SocketConnector.h:50
Generated by
1.9.1