gusimplewhiteboard
guWhiteboard::Channels Class Reference

Class which emulates the 2-process channel synchronisation system from UPPAAL. More...

#include <Channels.hpp>

Inheritance diagram for guWhiteboard::Channels:
Collaboration diagram for guWhiteboard::Channels:

Public Member Functions

bool waiting (int channel)
 check if a signal has been sent on a channel More...
 
void send (int channel)
 synchronise two machines: sender More...
 
void clear (int channel)
 clear sync signal from a channel More...
 
void reset ()
 reset all channel signals to zero More...
 
bool operator== (const Channels &other) const
 comparison operator More...
 
 Channels (const std::string &channel_values)
 string constructor More...
 
std::string description () const
 convert to a string More...
 
void from_string (const std::string &str)
 convert from a string More...
 
- Public Member Functions inherited from wb_channels
 ARRAY_PROPERTY (uint8_t, channels,(sizeof(gu_simple_message))) wb_channels()
 

Detailed Description

Class which emulates the 2-process channel synchronisation system from UPPAAL.

This is implemented as a bit vector, 1 bit per channel

Examples

// send a signal to channel #4
channels = Channels_t();
channels.send(4);

// wait for a channel signal to be sent
channels = Channels_t();
while (!channels.recieve(4)) { }

Definition at line 87 of file Channels.hpp.

Constructor & Destructor Documentation

◆ Channels()

guWhiteboard::Channels::Channels ( const std::string &  channel_values)
inline

string constructor

Definition at line 107 of file Channels.hpp.

References from_string().

Member Function Documentation

◆ clear()

void guWhiteboard::Channels::clear ( int  channel)
inline

clear sync signal from a channel

Definition at line 97 of file Channels.hpp.

References CHANNEL_CLEAR.

Referenced by from_string().

◆ description()

std::string guWhiteboard::Channels::description ( ) const
inline

convert to a string

Definition at line 110 of file Channels.hpp.

References CHANNEL_WAITING, and CHANNELS_COUNT.

◆ from_string()

void guWhiteboard::Channels::from_string ( const std::string &  str)
inline

convert from a string

Definition at line 124 of file Channels.hpp.

References CHANNELS_COUNT, clear(), IO_PIN_BIT_SIZE, and send().

Referenced by Channels().

◆ operator==()

bool guWhiteboard::Channels::operator== ( const Channels other) const
inline

comparison operator

Definition at line 103 of file Channels.hpp.

◆ reset()

void guWhiteboard::Channels::reset ( )
inline

reset all channel signals to zero

Definition at line 100 of file Channels.hpp.

◆ send()

void guWhiteboard::Channels::send ( int  channel)
inline

synchronise two machines: sender

Definition at line 94 of file Channels.hpp.

References CHANNEL_SEND.

Referenced by from_string().

◆ waiting()

bool guWhiteboard::Channels::waiting ( int  channel)
inline

check if a signal has been sent on a channel

Definition at line 91 of file Channels.hpp.

References CHANNEL_WAITING.


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