6#ifndef YARP_SHMEM_SHMEMPLATFORM_H
7#define YARP_SHMEM_SHMEMPLATFORM_H
27std::string
objectName(
const char* kind,
int port,
int index = -1);
42 bool create(
const std::string& name,
size_t size);
44 bool open(
const std::string& name);
48 static void unlink(
const std::string& name);
50 void*
data()
const {
return m_data; }
53 void* m_handle {
nullptr};
54 void* m_data {
nullptr};
73 bool create(
const std::string& name,
unsigned int initial,
unsigned int max);
75 bool open(
const std::string& name);
78 static void unlink(
const std::string& name);
87 void* m_handle {
nullptr};
106 bool connect(
const std::string& host,
int port);
109 bool sendAll(
const void* data,
size_t len);
111 bool recvAll(
void* data,
size_t len);
124 std::intptr_t m_fd {-1};
A named inter-process semaphore.
NamedSemaphore(const NamedSemaphore &)=delete
bool waitFor(double timeout)
Wait at most timeout seconds. Returns true if the semaphore was acquired.
bool wait()
Wait until the semaphore is available.
static void unlink(const std::string &name)
Remove the name of the semaphore (no-op on Windows)
bool create(const std::string &name, unsigned int initial, unsigned int max)
Create a new semaphore (removing any stale semaphore with the same name)
bool open(const std::string &name)
Open an existing semaphore.
NamedSemaphore & operator=(const NamedSemaphore &)=delete
A named shared memory segment.
static void unlink(const std::string &name)
Remove the name of the segment (no-op on Windows)
void close()
Unmap the segment.
SharedMemory & operator=(const SharedMemory &)=delete
bool create(const std::string &name, size_t size)
Create a new segment (removing any stale segment with the same name)
SharedMemory(const SharedMemory &)=delete
bool open(const std::string &name)
Open an existing segment.
A minimal IPv4 TCP socket.
Socket & operator=(const Socket &)=delete
bool recvAll(void *data, size_t len)
Receive exactly len bytes (blocking socket)
bool accept(Socket &stream)
Accept a connection on a listening socket.
bool connect(const std::string &host, int port)
bool listen(int port)
Listen on all the interfaces (port 0 means any free port)
bool isPeerClosed()
Check, on a non-blocking socket, whether the connection was closed or reset by the peer (e....
bool sendAll(const void *data, size_t len)
Send exactly len bytes (blocking socket)
Socket(const Socket &)=delete
bool getRemoteAddress(std::string &host, int &port) const
bool getLocalAddress(std::string &host, int &port) const
std::string objectName(const char *kind, int port, int index=-1)
Build the name of a named inter-process object.