upkie 6.1.0
Open-source wheeled biped robots
Loading...
Searching...
No Matches
upkie::cpp::spine::AgentInterface Class Reference

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.
 

Detailed Description

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

Constructor & Destructor Documentation

◆ AgentInterface()

upkie::cpp::spine::AgentInterface::AgentInterface ( const std::string &  name,
size_t  size 
)

Open interface to the agent at a given shared-memory file.

Parameters
[in]nameName of the shared memory file (e.g. "/upkie").
[in]sizeSize in bytes.

Shared memory objects are available as files in /dev/shm.

Member Function Documentation

◆ set_request()

void upkie::cpp::spine::AgentInterface::set_request ( Request  request)

Set current request in shared memory.

Parameters
[in]requestNew request.

◆ write()

void upkie::cpp::spine::AgentInterface::write ( char *  data,
size_t  size 
)

Write data to the data buffer in shared memory.

Parameters
[in]dataData to write.
[in]sizeNumber of bytes to write.

The documentation for this class was generated from the following files: