Keyple C++  0.9.0
Keyple, an Open Source SDK for Ticketing
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
keyple::core::seproxy::plugin::AbstractPlugin Class Referenceabstract

#include <AbstractPlugin.h>

Inherits keyple::core::seproxy::plugin::AbstractSeProxyComponent, and keyple::core::seproxy::ReaderPlugin.

Inherited by keyple::core::seproxy::plugin::AbstractObservablePlugin.

Public Member Functions

virtual ConcurrentMap< const std::string, std::shared_ptr< SeReader > > & getReaders () override
 
virtual const std::set< std::string > getReaderNames () const override
 
const std::shared_ptr< SeReadergetReader (const std::string &name) final
 
const std::string & getName () const
 
- Public Member Functions inherited from keyple::core::seproxy::plugin::AbstractSeProxyComponent
 AbstractSeProxyComponent (const std::string &name)
 
virtual ~AbstractSeProxyComponent ()=default
 
const std::string & getName () const
 
void setParameters (const std::map< const std::string, const std::string > &parameters)
 
virtual void setParameter (const std::string &key, const std::string &value)=0
 
- Public Member Functions inherited from keyple::core::seproxy::ReaderPlugin
virtual ~ReaderPlugin ()=default
 
- Public Member Functions inherited from keyple::core::seproxy::ProxyElement
virtual ~ProxyElement ()=default
 
virtual const std::string & getName () const =0
 
virtual const std::map< const std::string, const std::string > & getParameters () const =0
 
virtual void setParameter (const std::string &key, const std::string &value)=0
 
virtual void setParameters (const std::map< const std::string, const std::string > &parameters)
 

Protected Member Functions

 AbstractPlugin (const std::string &name)
 
virtual ~AbstractPlugin ()=default
 
virtual ConcurrentMap< const std::string, std::shared_ptr< SeReader > > & initNativeReaders ()=0
 

Protected Attributes

ConcurrentMap< const std::string, std::shared_ptr< SeReader > > mNativeReaders
 

Detailed Description

Observable plugin. These plugin can report when a reader is added or removed.

Constructor & Destructor Documentation

◆ AbstractPlugin()

keyple::core::seproxy::plugin::AbstractPlugin::AbstractPlugin ( const std::string &  name)
explicitprotected

Instanciates a new ReaderPlugin. Retrieve the current readers list.

Initialize the list of readers calling the abstract method initNativeReaders

When readers initialisation failed, a KeypleReaderException is thrown

Parameters
namename of the plugin
Exceptions
KeypleReaderExceptionwhen an issue is raised with reader

◆ ~AbstractPlugin()

virtual keyple::core::seproxy::plugin::AbstractPlugin::~AbstractPlugin ( )
protectedvirtualdefault

Member Function Documentation

◆ getName()

const std::string & keyple::core::seproxy::plugin::AbstractSeProxyComponent::getName
Returns
the name of the component

◆ getReader()

const std::shared_ptr< SeReader > keyple::core::seproxy::plugin::AbstractPlugin::getReader ( const std::string &  name)
finalvirtual

Gets a specific reader designated by its name in the current readers list

Parameters
nameof the reader
Returns
the reader
Exceptions
KeypleReaderNotFoundExceptionif the wanted reader is not found

Alex: once again the std::shared_ptr return type prevents us from using covariant return type. Downcasting to SeReader for now, but should be looked into, maybe returning a reference would could be best here?

Implements keyple::core::seproxy::ReaderPlugin.

◆ getReaderNames()

const std::set< std::string > keyple::core::seproxy::plugin::AbstractPlugin::getReaderNames ( ) const
overridevirtual

Returns the current list of reader names.

The list of names is built from the current readers list

Returns
a list of String

Implements keyple::core::seproxy::ReaderPlugin.

◆ getReaders()

ConcurrentMap< const std::string, std::shared_ptr< SeReader > > & keyple::core::seproxy::plugin::AbstractPlugin::getReaders ( )
overridevirtual

Returns the current readers name instance map.

The map is initialized in the constructor and may be updated in background in the case of a threaded plugin keyple::core::seproxy::plugin::AbstractThreadedObservablePlugin

Returns
the current readers map, can be an empty

Implements keyple::core::seproxy::ReaderPlugin.

◆ initNativeReaders()

virtual ConcurrentMap<const std::string, std::shared_ptr<SeReader> >& keyple::core::seproxy::plugin::AbstractPlugin::initNativeReaders ( )
protectedpure virtual

Init connected native readers (from third party library) and returns a map of corresponding keyple::core::seproxy::SeReader whith their name as key.

keyple::core::seproxy::SeReader are new instances.

this method is called once in the plugin constructor.

Returns
the map of AbstractReader objects.
Exceptions
KeypleReaderIOExceptionif the communication with the reader or the SE has failed

Implemented in keyple::plugin::stub::StubPluginImpl, and keyple::plugin::pcsc::PcscPluginImpl.

Member Data Documentation

◆ mNativeReaders

ConcurrentMap<const std::string, std::shared_ptr<SeReader> > keyple::core::seproxy::plugin::AbstractPlugin::mNativeReaders
protected

C++ vs. Java: store list in class to avoid copy or move operations on ConcurrentMap


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