cumbia-qtcontrols 1.x
Qt widgets on top of the cumbia C++ library
|
this class, used in conjunction with CumbiaPool allows to connect to different control system frameworks within the same application. More...
#include <cucontrolsfactorypool.h>
Public Types | |
enum | Type { Reader = 0 , Writer } |
Public Member Functions | |
CuControlsFactoryPool () | |
void | registerImpl (const std::string &domain, const CuControlsReaderFactoryI &rf) |
register a reader factory for a domain: More... | |
void | registerImpl (const std::string &domain, const CuControlsWriterFactoryI &wf) |
register a writer factory for a domain: More... | |
void | setSrcPatterns (const std::string &domain, const std::vector< std::string > ®exps) |
set or change the source patterns (regular expressions) for the domain More... | |
void | clearSrcPatterns (const std::string &domain) |
remove patterns for the given domain More... | |
CuControlsReaderFactoryI * | getReadFactory (const std::string &domain) const |
returns the reader factory that was registered with the given domain More... | |
CuControlsWriterFactoryI * | getWriteFactory (const std::string &domain) const |
returns the writer factory that was registered with the given domain More... | |
CuControlsReaderFactoryI * | getRFactoryBySrc (const std::string &src) const |
uses the registered patterns to match the given source and return a CuControlsReaderFactoryI if a correspondence is found. More... | |
CuControlsWriterFactoryI * | getWFactoryBySrc (const std::string &src) const |
uses the registered patterns to match the given source and return a CuControlsWriterFactoryI if a correspondence is found. More... | |
std::string | guessDomainBySrc (const std::string &src) const |
given the source string, , tries to match it with the registered patterns in order to return the associated domain name More... | |
bool | isEmpty () const |
returns true if both the reader factory map and the writer factory map are empty. More... | |
std::vector< std::string > | getSrcPatternDomains () const |
std::vector< std::string > | getSrcPatterns (const std::string &domain) const |
this class, used in conjunction with CumbiaPool allows to connect to different control system frameworks within the same application.
Reader and writer factories can be registered with registerImpl, providing a name for the domain they refer to. The following code registers reader and writer factories for epics and tango, making it possible to connect to sources belonging to these two different systems within the same application:
The setSrcPatterns method can be used to insert rules so that CuControlsFactoryPool can distribute sources among the registered engine implementations according to their syntax pattern:
CuControlsFactoryPool::CuControlsFactoryPool | ( | ) |
the class constructor
void CuControlsFactoryPool::clearSrcPatterns | ( | const std::string & | domain | ) |
remove patterns for the given domain
domain | a string with the domain name whose patterns are to be removed |
CuControlsReaderFactoryI * CuControlsFactoryPool::getReadFactory | ( | const std::string & | domain | ) | const |
returns the reader factory that was registered with the given domain
domain | the name of the domain registered with registerImpl |
Referenced by getRFactoryBySrc().
CuControlsReaderFactoryI * CuControlsFactoryPool::getRFactoryBySrc | ( | const std::string & | src | ) | const |
uses the registered patterns to match the given source and return a CuControlsReaderFactoryI if a correspondence is found.
src | the name of the source |
References getReadFactory(), and guessDomainBySrc().
std::vector< std::string > CuControlsFactoryPool::getSrcPatternDomains | ( | ) | const |
std::vector< std::string > CuControlsFactoryPool::getSrcPatterns | ( | const std::string & | domain | ) | const |
CuControlsWriterFactoryI * CuControlsFactoryPool::getWFactoryBySrc | ( | const std::string & | src | ) | const |
uses the registered patterns to match the given source and return a CuControlsWriterFactoryI if a correspondence is found.
src | the name of the source |
References getWriteFactory(), and guessDomainBySrc().
CuControlsWriterFactoryI * CuControlsFactoryPool::getWriteFactory | ( | const std::string & | domain | ) | const |
returns the writer factory that was registered with the given domain
domain | the name of the domain registered with registerImpl |
Referenced by getWFactoryBySrc().
std::string CuControlsFactoryPool::guessDomainBySrc | ( | const std::string & | src | ) | const |
given the source string, , tries to match it with the registered patterns in order to return the associated domain name
src | the source name |
Referenced by getRFactoryBySrc(), and getWFactoryBySrc().
bool CuControlsFactoryPool::isEmpty | ( | ) | const |
returns true if both the reader factory map and the writer factory map are empty.
Referenced by QmlReaderBackend::init().
void CuControlsFactoryPool::registerImpl | ( | const std::string & | domain, |
const CuControlsReaderFactoryI & | rf | ||
) |
register a reader factory for a domain:
domain | a string identifying a domain, e.g. "tango" or "epics" |
rf | an instance of an object implementing CuControlsReaderFactoryI, such as CuTReaderFactory or CuEpReaderFactory |
References CuControlsReaderFactoryI::clone().
Referenced by main().
void CuControlsFactoryPool::registerImpl | ( | const std::string & | domain, |
const CuControlsWriterFactoryI & | wf | ||
) |
register a writer factory for a domain:
domain | a string identifying a domain, e.g. "tango" or "epics" |
wf | an instance of an object implementing CuControlsWriterFactoryI, such as CuTWriterFactory or CuEpWriterFactory |
References CuControlsWriterFactoryI::clone().
void CuControlsFactoryPool::setSrcPatterns | ( | const std::string & | domain, |
const std::vector< std::string > & | regex_patt | ||
) |
set or change the source patterns (regular expressions) for the domain
domain | a string identifying a domain, e.g. "tango" or "epics" |
regex_patt | a vector of string with the set of regular expressions that are used to match and assign sources to engines. |
Referenced by main().