RTXI 3.0.0 The Real-Time eXperiment Interface Reference Manual |
#include <rt.hpp>
Public Member Functions | |
Connector ()=default | |
Connector (const Connector &connector)=delete | |
Connector & | operator= (const Connector &connector)=delete |
Connector (Connector &&)=delete | |
Connector & | operator= (Connector &&)=delete |
~Connector ()=default | |
int | connect (block_connection_t connection) |
void | disconnect (block_connection_t connection) |
bool | connected (block_connection_t connection) |
void | insertBlock (IO::Block *block, std::vector< RT::block_connection_t > &block_connections) |
void | removeBlock (IO::Block *block) |
bool | isRegistered (IO::Block *block) |
std::vector< RT::Device * > | getDevices () |
std::vector< RT::Thread * > | getThreads () |
std::vector< RT::block_connection_t > | getOutputs (IO::Block *src) |
void | propagateBlockConnections (IO::Block *block) |
void | clearAllConnections (IO::Block *block) |
std::vector< IO::Block * > | getRegisteredBlocks () |
std::vector< RT::block_connection_t > | getAllConnections () |
Class that manages connections between blocks.
The connector class, which should not be confused with the connector plugin, is used by RT::System class during runtime to correctly connect and schedule blocks before execution. Most of the connector class functionality is used outside of real-time, but some can and should be used in the real-time context. this class can also differentiate between RT::Device and RT::Thread and keeps a registry of all connections. FInally, Connector class is responsible for moving outputs of blocks to their appropriate inputs during runtime.
The connector plugin communicates with RT::System through events to query and establish block connections.
| default |
| delete |
| delete |
| default |
void RT::Connector::clearAllConnections | ( | IO::Block * | block | ) |
int RT::Connector::connect | ( | RT::block_connection_t | connection | ) |
Create a connection between source and destination block.
src | The source of the data. |
out | The source channel of the data. |
dest | The destination of the data. |
in | The destination channel of the data. |
Definition at line 50 of file rt.cpp.
bool RT::Connector::connected | ( | RT::block_connection_t | connection | ) |
Determine whether source and destination blocks are connected.
src | The source of the data. |
out | The source channel of the data. |
dest | The destination of the data. |
in | The destination channel of the data. |
Definition at line 70 of file rt.cpp.
void RT::Connector::disconnect | ( | RT::block_connection_t | connection | ) |
Break a connection between source and destination blocks.
src | The source of the data. |
out | The source channel of the data. |
dest | The destination of the data. |
in | The destination channel of the data. |
Definition at line 84 of file rt.cpp.
std::vector< RT::block_connection_t > RT::Connector::getAllConnections | ( | ) |
Query all connections in RTXI
std::vector< RT::Device * > RT::Connector::getDevices | ( | ) |
Get the list of devices that are registered with connector class.
To the connector class devices are io blocks that are independent of other blocks when connected.
std::vector< RT::block_connection_t > RT::Connector::getOutputs | ( | IO::Block * | src | ) |
Returns a list of output connections for the given block
src | Source IO::Block pointer to find the connections for |
Definition at line 227 of file rt.cpp.
std::vector< IO::Block * > RT::Connector::getRegisteredBlocks | ( | ) |
std::vector< RT::Thread * > RT::Connector::getThreads | ( | ) |
Get a list of threads that are registered with connector class.
To the connector class threads are blocks that are dependent of other blocks when connected. They are topologically sorted.
void RT::Connector::insertBlock | ( | IO::Block * | block, |
std::vector< RT::block_connection_t > & | block_connections | ||
) |
Register the block in order to access connection services
The caller of this function must provide a pointer to the memory that the real-time thread will use to store connections. This is an optimization that avoids memory allocations in rt-thread as much as possible
thread | Pointer to block object to register |
block_connections | pointer to the vector connections memory to use |
Definition at line 100 of file rt.cpp.
bool RT::Connector::isRegistered | ( | IO::Block * | block | ) |
void RT::Connector::propagateBlockConnections | ( | IO::Block * | block | ) |
Copies outputs of the given block
This function is used in the real-time loop to propagate values from one block to another. It works by using the assigned index of the block to quickly access the block, then iterates through all connections of the block and copies output values to the input values of the next block.
Pointer | to block that is the source of the output. |
Definition at line 235 of file rt.cpp.
void RT::Connector::removeBlock | ( | IO::Block * | block | ) |