Rose
Public Types | Public Member Functions | Public Attributes | Protected Types | Protected Attributes | List of all members
rose::RadioBehavior Class Reference
Collaboration diagram for rose::RadioBehavior:
Collaboration graph
[legend]

Public Types

enum  State { None, SetClear, Set }
 
using SignalType = std::tuple< State, int, SignalToken >
 

Public Member Functions

 RadioBehavior (bool noneIsValid)
 Constructor. More...
 
void emplace_back (std::shared_ptr< ButtonFrame > &button)
 Add a ButtonFrame to the set. More...
 
void clear ()
 Remove all ButtonFrames from the set. More...
 
void clearState ()
 Clear the state. More...
 
std::pair< State, int > getState () const
 Get the current state of the RadioBehavior. More...
 
void setState (std::pair< State, int > state)
 Set the state, see setState(State,int). More...
 
void setState (State state, int selected)
 Set the state. More...
 

Public Attributes

Signal< SignalType > stateTx {}
 

Protected Types

using ButtonListType = std::pair< SignalToken, shared_ptr< ButtonFrame > >
 

Protected Attributes

State mState {None}
 The current state.
 
int mSelected {0}
 The current selected ButtonFrame if any.
 
bool mNoneIsValid {}
 True if all off is a valid state.
 
std::vector< ButtonListType > mButtons {}
 The list of Radio Buttons.
 
SignalSerialNumber mSignalSerialNumber {}
 The object signal serial number.
 
std::shared_ptr< Slot< ButtonFrame::SignalType > > buttonStateRx {}
 Receive managed button state.
 

Constructor & Destructor Documentation

◆ RadioBehavior()

rose::RadioBehavior::RadioBehavior ( bool  noneIsValid)
inlineexplicit

Constructor.

Parameters
noneIsValidSet whether the all buttons off is a valid state.

Member Function Documentation

◆ clear()

void rose::RadioBehavior::clear ( )

Remove all ButtonFrames from the set.

The resulting state (cleared to none) is transmitted.

◆ clearState()

void rose::RadioBehavior::clearState ( )

Clear the state.

A clear state is all buttons off, if that is valid, or the first ButtonFrame on. The resulting state is transmitted.

◆ emplace_back()

void rose::RadioBehavior::emplace_back ( std::shared_ptr< ButtonFrame > &  button)

Add a ButtonFrame to the set.

Parameters
buttonThe ButtonFrame to add.

◆ getState()

std::pair<State,int> rose::RadioBehavior::getState ( ) const
inline

Get the current state of the RadioBehavior.

Returns
A std::pair with the State and Selected button.

◆ setState() [1/2]

void rose::RadioBehavior::setState ( std::pair< State, int >  state)
inline

Set the state, see setState(State,int).

Parameters
stateA std::pair with the new state.

◆ setState() [2/2]

void rose::RadioBehavior::setState ( RadioBehavior::State  state,
int  selected 
)

Set the state.

If the requested state is invalid, the state is cleared. The new state is transmitted.

Parameters
stateThe selection State.
selectedThe selected ButtonFrame.

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