Keyple C++  0.9.0
Keyple, an Open Source SDK for Ticketing
Public Member Functions | Friends | List of all members
keyple::core::selection::SelectionsResult Class Referencefinal

#include <SelectionsResult.h>

Inherits enable_shared_from_this< SelectionsResult >.

Public Member Functions

 SelectionsResult ()
 
void addMatchingSe (int selectionIndex, const std::shared_ptr< AbstractMatchingSe > matchingSe, bool isSelected)
 
const std::shared_ptr< AbstractMatchingSegetActiveMatchingSe ()
 
const std::map< int, std::shared_ptr< AbstractMatchingSe > > & getMatchingSelections () const
 
const std::shared_ptr< AbstractMatchingSegetMatchingSe (int selectionIndex)
 
bool hasActiveSelection () const
 
bool hasSelectionMatched (int selectionIndex) const
 
int getActiveSelectionIndex () const
 

Friends

KEYPLECORE_API std::ostream & operator<< (std::ostream &os, const SelectionsResult &sr)
 
KEYPLECORE_API std::ostream & operator<< (std::ostream &os, const std::shared_ptr< SelectionsResult > &sr)
 
KEYPLECORE_API std::ostream & operator<< (std::ostream &os, const std::map< int, std::shared_ptr< AbstractMatchingSe >> &sr)
 

Detailed Description

The SelectionsResult class holds the result of a selection process.

Embeds a map of keyple::core::selection::AbstractMatchingSe. At most one of these matching SE is active.
Provides a set of methods to retrieve the active selection (getActiveMatchingSe) or a particular matching SE specified by its index.

Constructor & Destructor Documentation

◆ SelectionsResult()

keyple::core::selection::SelectionsResult::SelectionsResult ( )

Constructor

Member Function Documentation

◆ addMatchingSe()

void keyple::core::selection::SelectionsResult::addMatchingSe ( int  selectionIndex,
const std::shared_ptr< AbstractMatchingSe matchingSe,
bool  isSelected 
)

Append a keyple::core::selection::AbstractMatchingSe to the internal list

Parameters
selectionIndexthe index of the selection that resulted in the matching SE
matchingSethe matching SE to add
isSelectedtrue if the currently added matching SE is selected (its logical channel is open)

◆ getActiveMatchingSe()

const std::shared_ptr< AbstractMatchingSe > keyple::core::selection::SelectionsResult::getActiveMatchingSe ( )

Get the active matching SE. I.e. the SE that has been selected.
The hasActiveSelection method should be called before.

Returns
the currently active matching SE
Exceptions
IllegalStateExceptionif no active matching SE is found

◆ getActiveSelectionIndex()

int keyple::core::selection::SelectionsResult::getActiveSelectionIndex ( ) const
Returns
the index of the active selection

◆ getMatchingSe()

const std::shared_ptr< AbstractMatchingSe > keyple::core::selection::SelectionsResult::getMatchingSe ( int  selectionIndex)

Gets the keyple::core::selection::AbstractMatchingSe for the specified index.

Returns null if no keyple::core::selection::AbstractMatchingSe was found.

Parameters
selectionIndexthe selection index
Returns
the keyple::core::selection::AbstractMatchingSe or null

◆ getMatchingSelections()

const std::map< int, std::shared_ptr< AbstractMatchingSe > > & keyple::core::selection::SelectionsResult::getMatchingSelections ( ) const

◆ hasActiveSelection()

bool keyple::core::selection::SelectionsResult::hasActiveSelection ( ) const
Returns
true if an active selection is present

◆ hasSelectionMatched()

bool keyple::core::selection::SelectionsResult::hasSelectionMatched ( int  selectionIndex) const

Get the matching status of a selection for which the index is provided.
Checks for the presence of an entry in the MatchingSe Map for the given index

Parameters
selectionIndexthe selection index
Returns
true if the selection has matched

Friends And Related Function Documentation

◆ operator<< [1/3]

KEYPLECORE_API std::ostream& operator<< ( std::ostream &  os,
const SelectionsResult sr 
)
friend

◆ operator<< [2/3]

KEYPLECORE_API std::ostream& operator<< ( std::ostream &  os,
const std::map< int, std::shared_ptr< AbstractMatchingSe >> &  sr 
)
friend

◆ operator<< [3/3]

KEYPLECORE_API std::ostream& operator<< ( std::ostream &  os,
const std::shared_ptr< SelectionsResult > &  sr 
)
friend

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