14#include "keyple/core/service/CardSelectionResultAdapter.hpp"
19#include "keyple/core/util/cpp/exception/IllegalStateException.hpp"
25using keyple::core::util::cpp::exception::IllegalStateException;
27CardSelectionResultAdapter::CardSelectionResultAdapter()
28: mActiveSelectionIndex(-1)
33CardSelectionResultAdapter::addSmartCard(
34 const int selectionIndex, std::shared_ptr<SmartCard> smartCard)
36 mSmartCardMap.insert({selectionIndex, smartCard});
39 mActiveSelectionIndex = selectionIndex;
42const std::map<int, std::shared_ptr<SmartCard>>&
43CardSelectionResultAdapter::getSmartCards()
const
48std::shared_ptr<SmartCard>
49CardSelectionResultAdapter::getActiveSmartCard()
const
51 const auto& it = mSmartCardMap.find(mActiveSelectionIndex);
53 return (it != mSmartCardMap.end()) ? it->second :
nullptr;
57CardSelectionResultAdapter::getActiveSelectionIndex()
const
59 return mActiveSelectionIndex;