RTXI  3.0.0
The Real-Time eXperiment Interface Reference Manual
Public Member Functions
RT::OS::Fifo Class Referenceabstract

#include <fifo.hpp>

Inheritance diagram for RT::OS::Fifo:
Inheritance graph
Collaboration diagram for RT::OS::Fifo:
Collaboration graph

Public Member Functions

 Fifo ()=default
 
 Fifo (const Fifo &fifo)=delete
 
Fifooperator= (const Fifo &fifo)=delete
 
 Fifo (Fifo &&)=default
 
Fifooperator= (Fifo &&)=default
 
virtual ~Fifo ()=default
 
virtual int64_t read (void *buf, size_t data_size)=0
 
virtual int64_t write (void *buf, size_t data_size)=0
 
virtual int64_t readRT (void *buf, size_t data_size)=0
 
virtual int64_t writeRT (void *buf, size_t data_size)=0
 
virtual size_t getCapacity ()=0
 
virtual void poll ()=0
 
virtual void close ()=0
 

Detailed Description

Simple FIFO(First In First Out) for data transfer between RTXI threads

This data structure is a fundamental component to the inter-process communication between threads spawned by RTXI. In particular this is used for communication between the real-time thread and non-realtime(UI) threads. This is platform and interface dependent, so the FIFO primitive used in posix interface will be different than Xenomai's evl interface

This structure should not be used between two threads of the same priority. It is meant only for realtime and non-realtime thread communications. In the case where you need communication between two ui threads, consider using a message queue. for communication between two RT threads, use the underlying OS provided IPCs.

Definition at line 45 of file fifo.hpp.

Constructor & Destructor Documentation

◆ Fifo() [1/3]

RT::OS::Fifo::Fifo()
default

◆ Fifo() [2/3]

RT::OS::Fifo::Fifo(const Fifofifo)
delete

◆ Fifo() [3/3]

RT::OS::Fifo::Fifo(Fifo && )
default

◆ ~Fifo()

virtual RT::OS::Fifo::~Fifo()
virtualdefault

Member Function Documentation

◆ close()

virtual void RT::OS::Fifo::close()
pure virtual

Closes the handle stored and prevents reading from the ui side

Implemented in RT::OS::xenomaiFifo, RT::OS::posixFifo, RT::OS::evlFifo, and RT::OS::xbuffFifo.

◆ getCapacity()

virtual size_t RT::OS::Fifo::getCapacity()
pure virtual

Get the memory capacity of the fifo

Returns
The maximum amount of memory the fifo can hold

Implemented in RT::OS::xenomaiFifo, RT::OS::posixFifo, RT::OS::evlFifo, and RT::OS::xbuffFifo.

◆ operator=() [1/2]

Fifo& RT::OS::Fifo::operator=(const Fifofifo)
delete

◆ operator=() [2/2]

Fifo& RT::OS::Fifo::operator=(Fifo && )
default

◆ poll()

virtual void RT::OS::Fifo::poll()
pure virtual

Checks whether there is available data to read on the non-rt side

This function is primarily for non-rt threads to wait on available data from the rt thread. It blocks (sleeps) the calling thread until woken by data availability. SHOULD NOT RUN IN REAL TIME!!

Implemented in RT::OS::xenomaiFifo, RT::OS::posixFifo, RT::OS::evlFifo, and RT::OS::xbuffFifo.

◆ read()

virtual int64_t RT::OS::Fifo::read(void * buf,
size_t data_size 
)
pure virtual

Read the data stored in the FIFO written by realtime thread. Must be run from non-rt thread.

Parameters
bufThe buffer where the data from the buffer should be written to
data_sizeThe size of the data to read from the buffer
Returns
n Number of elements read. Same as size.

Implemented in RT::OS::posixFifo, RT::OS::xbuffFifo, RT::OS::xenomaiFifo, and RT::OS::evlFifo.

◆ readRT()

virtual int64_t RT::OS::Fifo::readRT(void * buf,
size_t data_size 
)
pure virtual

Read the data stored in the FIFO written by non-RT thread. Must be run from realtime thread.

Parameters
bufThe buffer where the data from the buffer should be written to
data_sizeThe size of the data to read from the buffer
Returns
n Number of elements read. Same as size.

Implemented in RT::OS::posixFifo, RT::OS::xbuffFifo, RT::OS::xenomaiFifo, and RT::OS::evlFifo.

◆ write()

virtual int64_t RT::OS::Fifo::write(void * buf,
size_t data_size 
)
pure virtual

Write to the FIFO storage for the realtime thread. Must be run from non-rt thread.

Parameters
bufThe buffer holding the data to write to the FIFO.
data_sizeThe size of the data to read from the buffer
Returns
n Number of elements written. Same as size.

Implemented in RT::OS::posixFifo, RT::OS::xbuffFifo, RT::OS::xenomaiFifo, and RT::OS::evlFifo.

◆ writeRT()

virtual int64_t RT::OS::Fifo::writeRT(void * buf,
size_t data_size 
)
pure virtual

Write to the FIFO storage for the non-RT thread. Must be run from realtime thread.

Parameters
bufThe buffer holding the data to write to the FIFO.
data_sizeThe size of the data to read from the buffer
Returns
n Number of elements written. Same as size.

Implemented in RT::OS::posixFifo, RT::OS::xbuffFifo, RT::OS::xenomaiFifo, and RT::OS::evlFifo.


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