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

#include <rt.hpp>

Collaboration diagram for RT::Connector:
Collaboration graph

Public Member Functions

 Connector ()=default
 
 Connector (const Connector &connector)=delete
 
Connectoroperator= (const Connector &connector)=delete
 
 Connector (Connector &&)=delete
 
Connectoroperator= (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_tgetOutputs (IO::Block *src)
 
void propagateBlockConnections (IO::Block *block)
 
void clearAllConnections (IO::Block *block)
 
std::vector< IO::Block * > getRegisteredBlocks ()
 
std::vector< RT::block_connection_tgetAllConnections ()
 

Detailed Description

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.

See also
IO::Block
Connector::Plugin

Definition at line 222 of file rt.hpp.

Constructor & Destructor Documentation

◆ Connector() [1/3]

RT::Connector::Connector()
default

◆ Connector() [2/3]

RT::Connector::Connector(const Connectorconnector)
delete

◆ Connector() [3/3]

RT::Connector::Connector(Connector && )
delete

◆ ~Connector()

RT::Connector::~Connector()
default

Member Function Documentation

◆ clearAllConnections()

void RT::Connector::clearAllConnections(IO::Blockblock)

Destroys all connections for a given block

Parameters
blockThe IO::Block object pointer to remove connections from

Definition at line 243 of file rt.cpp.

◆ connect()

int RT::Connector::connect(RT::block_connection_t connection)

Create a connection between source and destination block.

Parameters
srcThe source of the data.
outThe source channel of the data.
destThe destination of the data.
inThe destination channel of the data.
Returns
0 if successfully connected, -1 if it found a cycle
See also
IO::Block

Definition at line 50 of file rt.cpp.

Here is the call graph for this function:

◆ connected()

bool RT::Connector::connected(RT::block_connection_t connection)

Determine whether source and destination blocks are connected.

Parameters
srcThe source of the data.
outThe source channel of the data.
destThe destination of the data.
inThe destination channel of the data.
See also
IO::Block::connect()
IO::Block::disconnect()

Definition at line 70 of file rt.cpp.

Here is the call graph for this function:

◆ disconnect()

void RT::Connector::disconnect(RT::block_connection_t connection)

Break a connection between source and destination blocks.

Parameters
srcThe source of the data.
outThe source channel of the data.
destThe destination of the data.
inThe destination channel of the data.
See also
IO::Block
IO::Block::writeinput()
IO::Block::readoutput()

Definition at line 84 of file rt.cpp.

Here is the call graph for this function:

◆ getAllConnections()

std::vector< RT::block_connection_t > RT::Connector::getAllConnections()

Query all connections in RTXI

Returns
A vector of RT::block_connection_t representing all connections in the connector class registry
See also
RT::block_connection_t

Definition at line 265 of file rt.cpp.

◆ getDevices()

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.

Returns
vector of RT::Device pointers representing registered devices

Definition at line 208 of file rt.cpp.

◆ getOutputs()

std::vector< RT::block_connection_t > RT::Connector::getOutputs(IO::Blocksrc)

Returns a list of output connections for the given block

Parameters
srcSource IO::Block pointer to find the connections for
Returns
A vector of RT::block_connection_t containing connection info
See also
RT::block_connection_t

Definition at line 227 of file rt.cpp.

Here is the call graph for this function:

◆ getRegisteredBlocks()

std::vector< IO::Block * > RT::Connector::getRegisteredBlocks()

Query all registered blocks

Returns
A vector of IO::Block pointers that are registered with the connector

Definition at line 254 of file rt.cpp.

◆ getThreads()

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.

Returns
vector of RT::Thread pointers representing registered threads

Definition at line 222 of file rt.cpp.

◆ insertBlock()

void RT::Connector::insertBlock(IO::Blockblock,
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

Parameters
threadPointer to block object to register
block_connectionspointer to the vector connections memory to use

Definition at line 100 of file rt.cpp.

Here is the call graph for this function:

◆ isRegistered()

bool RT::Connector::isRegistered(IO::Blockblock)

Checks whether block is registered with the connector

Parameters
IO::BlockPointer to block
Returns
true if registered, false otherwise

Definition at line 142 of file rt.cpp.

Here is the call graph for this function:

◆ operator=() [1/2]

Connector& RT::Connector::operator=(Connector && )
delete

◆ operator=() [2/2]

Connector& RT::Connector::operator=(const Connectorconnector)
delete

◆ propagateBlockConnections()

void RT::Connector::propagateBlockConnections(IO::Blockblock)

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.

Parameters
Pointerto block that is the source of the output.

Definition at line 235 of file rt.cpp.

Here is the call graph for this function:

◆ removeBlock()

void RT::Connector::removeBlock(IO::Blockblock)

Unregister the block from the registry

Parameters
blockPointer to block to unregister

Definition at line 132 of file rt.cpp.

Here is the call graph for this function:

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