upkie 6.1.0
Open-source wheeled biped robots
|
Memory map to shared memory. More...
#include <AgentInterface.h>
Public Member Functions | |
AgentInterface (const std::string &name, size_t size) | |
Open interface to the agent at a given shared-memory file. More... | |
~AgentInterface () | |
Unmap memory and unlink shared memory object. | |
void | set_request (Request request) |
Set current request in shared memory. More... | |
void | write (char *data, size_t size) |
Write data to the data buffer in shared memory. More... | |
Request | request () const |
Get current request from shared memory. | |
uint32_t | size () const |
Get size of current data buffer. | |
const char * | data () const |
Get pointer to data buffer. | |
Memory map to shared memory.
On memory mapping, shared memory and memory-mapped files: https://w3.cs.jmu.edu/kirkpams/OpenCSF/Books/csf/html/MMap.html
upkie::cpp::spine::AgentInterface::AgentInterface | ( | const std::string & | name, |
size_t | size | ||
) |
Open interface to the agent at a given shared-memory file.
[in] | name | Name of the shared memory file (e.g. "/upkie"). |
[in] | size | Size in bytes. |
Shared memory objects are available as files in /dev/shm
.
void upkie::cpp::spine::AgentInterface::set_request | ( | Request | request | ) |
Set current request in shared memory.
[in] | request | New request. |
void upkie::cpp::spine::AgentInterface::write | ( | char * | data, |
size_t | size | ||
) |
Write data to the data buffer in shared memory.
[in] | data | Data to write. |
[in] | size | Number of bytes to write. |