Module: sys_interface

struct MessageInterfaceMatch
#include <sys_interface.h>

This struct is dual purpose. The comments in-line describe the use as it is in the processData variable. Here, the block comment describes its used as it is in messageTraffic: std::string messageSource Name of message in source buffer std::string messageDest Name of message in dest buffer (left blank i.e. same name) int64_t source the ID for the message in its source buffer int64_t destination The ID for the message in the destination buffer uint64_t updateCounter the number of times a message had been written last time it was routed

Public Members

std::string messageSource

(-) name of process to get message from

std::string messageDest

(-) name of process to put message in

int64_t source

The ID for the buffer to copy messages from (negative indicates not ready)

int64_t destination

The ID for the buffer to copy messages to (negative indicates not ready)

uint64_t updateCounter

(-) The number of times a message had been written last time it was routed.

class InterfaceDataExchange : public SysModel
#include <sys_interface.h>

This class encapsulates the interface from a single source to a single destination. A SysInterface has a list of these.

Public Functions

InterfaceDataExchange()

Contruct an InterfaceDataExchange()

~InterfaceDataExchange()

Destroy an InterfaceDataExchange()

bool linkProcesses()

uses the input process names to

Get IDs for the to/from processes

Return

bool buffersFound

bool linkMessages()

get read/write permission in source/destination buffers

This method links the messages across buffers, which means: 1) It gets Write permission in the destination buffer 2) It gets Read permision in the source buffer

Return

bool messagedLinked whether or not the messages are linked

void discoverMessages()

looks for unpublished messages in the buffer and adds them to the list

This method checks the destination buffer for unpublished messages Then, it switches to the source buffer and if the message exists, adds it to the messageTraffic

void routeMessages()

copy message data from source to destination

Read all messages from source and write to destination

Return

void

Public Members

bool exchangeActive

(-) Flag indicating that exchange is active

MessageInterfaceMatch processData

Definition of process movement.

std::vector<MessageInterfaceMatch> messageTraffic

Message movement.

bool needDelete

Used by destructor to clear memory for this exchange.

BSKLogger bskLogger

BSK Logging

Private Members

uint64_t msgBufferSize

size of message in bytes currently being routed

uint8_t *msgBuffer
class SysInterface
#include <sys_interface.h>

This class is used to organize and manage all of the interfaces for a specific process. Like an interface manager. It maintains a list of InterfaceDataExchange. For instance,

Public Functions

SysInterface()

Create a SysInterface

~SysInterface()

Destruct a SysInterface

void addNewInterface(std::string from, std::string to, std::string intName = "")

Create a new interface from “from” process to “to” process. Auto-names the interface if the name provided is “”.

Return

void

Parameters
  • std::string: from process to read messages from

  • std::string: to process to copy messages to

  • std::string: intName name of this new interface

void addNewInterface(InterfaceDataExchange *newInterface)

Add an existing interface, but resets the destination and source to -1

Return

void

Parameters
  • InterfaceDataExchange*: newInterface

void enableInterface()
void disableInterface()
void routeInputs(int64_t processBuffer)

Routes messages. Only if the interface is active. If interfaces are not linked, then they are connected first.

Return

void

Parameters
  • int64_t: processBuffer not used

void discoverAllMessages()

This method goes over all interfaces and links processes and discovers messages

void connectInterfaces()

This method connects interfaces. If the processes won’t link, the interface is disabled and the user is warned

Return

void

Public Members

std::vector<InterfaceDataExchange*> interfaceDef

List of interfaces.

bool interfaceActive

Flag indicate whether interface has been disabled

bool interfacesLinked

(-) Flag indicating ints have all been linked

BSKLogger bskLogger

BSK Logging

Private Members

InterfaceDataExchange *currentInterface

(-) allows user to get/set msgs for single int