MeVisLab Toolbox Reference
Socket.h
Go to the documentation of this file.
1// Copyright (c) Fraunhofer MEVIS, Germany. All rights reserved.
2// **InsertLicense** code
3
4#pragma once
5
6#include <asio/System.h>
7#include <asio/ErrorCodes.h>
8
9#include <FMEThirdPartyWarningsDisable.h>
10#include <functional>
11#include <cstddef>
12#include <FMEThirdPartyWarningsRestore.h>
13
14
15namespace asio {
16
24 {
25 public:
26
27 using CompletionHandler = std::function<void(const ErrorCode&, const std::size_t /* number of bytes transferred */)>;
28
29 virtual ~Socket() = default;
30
31 virtual bool is_valid() const = 0;
32
33 virtual void async_read(void* buffer, const std::size_t buffer_size, const CompletionHandler& handler) = 0;
34
35 virtual void async_write(const void* buffer, const std::size_t buffer_size, const CompletionHandler& handler) = 0;
36
37 virtual void close() = 0;
38 };
39
40}
#define ASYNCHRONOUSIO_EXPORT
Definition System.h:10
Abstract base class for an asynchronous channel supporting read and write of binary data.
Definition Socket.h:24
virtual ~Socket()=default
virtual void close()=0
std::function< void(const ErrorCode &, const std::size_t)> CompletionHandler
Definition Socket.h:27
virtual bool is_valid() const =0
virtual void async_read(void *buffer, const std::size_t buffer_size, const CompletionHandler &handler)=0
virtual void async_write(const void *buffer, const std::size_t buffer_size, const CompletionHandler &handler)=0
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
boost::system::error_code ErrorCode
Definition ErrorCodes.h:13