cumbia 1.x
general purpose multi threaded library
|
used in combination with CuControlsFactoryPool, the class can be used to create applications that can connect to sources or targets belonging to different control system frameworks More...
#include <cumbiapool.h>
Public Member Functions | |
CumbiaPool () | |
the class constructor More... | |
void | registerCumbiaImpl (const std::string &name, Cumbia *cumbia) |
register a cumbia implementation with a given domain More... | |
void | setSrcPatterns (const std::string &name, const std::vector< std::string > ®exps) |
associate to a domain name a list of regular expressions describing the source syntax for that domain. More... | |
void | clearSrcPatterns (const std::string &name) |
remove the source patterns for the given domain More... | |
void | unregisterCumbiaImpl (const std::string &name) |
remove the domain from the list of the registered ones. More... | |
Cumbia * | get (const std::string &name) const |
get the Cumbia implementation that was registered with the given domain name More... | |
Cumbia * | getBySrc (const std::string &src) const |
Calls get with the domain extracted from the full source name "src". More... | |
Cumbia * | guessBySrc (const std::string &src) const |
given the source string, tries to match it with the registered patterns in order to return the associated Cumbia implementation. More... | |
bool | isEmpty () const |
returns true if the CumbiaPool has no registered domains/Cumbia implementations More... | |
const std::vector< std::string > | names () const |
used in combination with CuControlsFactoryPool, the class can be used to create applications that can connect to sources or targets belonging to different control system frameworks
Declare CumbiaPool in your main class so that it's visible across the whole application.
You need to instantiate the desired Cumbia engines and register them with registerCumbiaImpl. Then you must call setSrcPatterns for each "domain" name (e.g. "tango" or "epics") The following code shows an example. It integrates the considerations done in the CuControlsFactoryPool documentation.
CumbiaPool::CumbiaPool | ( | ) |
the class constructor
Creates an empty CumbiaPool with no registered implementations
void CumbiaPool::clearSrcPatterns | ( | const std::string & | name | ) |
remove the source patterns for the given domain
domain | the domain name whose patterns will be removed |
Cumbia * CumbiaPool::get | ( | const std::string & | domain | ) | const |
get the Cumbia implementation that was registered with the given domain name
domain | the name of the domain associated with a Cumbia implementation through a previous call to registerCumbiaImpl |
Referenced by getBySrc(), and guessBySrc().
Cumbia * CumbiaPool::getBySrc | ( | const std::string & | src | ) | const |
Calls get with the domain extracted from the full source name "src".
src | the name of the data source. Must begin with the domain name followed by ://, for example epics://foo:bar |
References get(), guessBySrc(), and perr.
Cumbia * CumbiaPool::guessBySrc | ( | const std::string & | src | ) | const |
given the source string, tries to match it with the registered patterns in order to return the associated Cumbia implementation.
src | the source name |
Referenced by getBySrc().
bool CumbiaPool::isEmpty | ( | ) | const |
returns true if the CumbiaPool has no registered domains/Cumbia implementations
const std::vector< std::string > CumbiaPool::names | ( | ) | const |
void CumbiaPool::registerCumbiaImpl | ( | const std::string & | domain, |
Cumbia * | cumbia | ||
) |
register a cumbia implementation with a given domain
domain | a string identifying a domain name, e.g. "tango" or "epics" |
cumbia,an | instance of a Cumbia implementation, such as CumbiaEpics or CumbiaTango. |
void CumbiaPool::setSrcPatterns | ( | const std::string & | domain, |
const std::vector< std::string > & | regexps | ||
) |
associate to a domain name a list of regular expressions describing the source syntax for that domain.
void CumbiaPool::unregisterCumbiaImpl | ( | const std::string & | domain | ) |
remove the domain from the list of the registered ones.
domain | the domain with this name will be removed from the CumbiaPool domain list |