remove compat ChannelProviderRegistry
signal effective API compatibility break due to change in shared_ptr ownership rules surrounding ChannelProvder.
This commit is contained in:
@@ -1367,20 +1367,26 @@ private:
|
||||
providers_t providers;
|
||||
};
|
||||
|
||||
/** Access to the global ChannelProviderRegistry instance.
|
||||
/* Deprecated in favor of either ChannelProviderRegistry::clients() or ChannelProviderRegistry::servers()
|
||||
*
|
||||
* Never returns NULL
|
||||
*
|
||||
* @deprecated Deprecated in favor of either ChannelProviderRegistry::clients() or ChannelProviderRegistry::servers()
|
||||
* These functions have been removed as a signal that the shared_ptr ownership symantics of ChannelProvider
|
||||
* and friends has changed.
|
||||
*/
|
||||
epicsShareFunc ChannelProviderRegistry::shared_pointer getChannelProviderRegistry() EPICS_DEPRECATED;
|
||||
//! Shorthand for getChannelProviderRegistry()->add(channelProviderFactory);
|
||||
epicsShareFunc void registerChannelProviderFactory(ChannelProviderFactory::shared_pointer const & channelProviderFactory) EPICS_DEPRECATED;
|
||||
//! Shorthand for getChannelProviderRegistry()->remove(channelProviderFactory);
|
||||
epicsShareFunc void unregisterChannelProviderFactory(ChannelProviderFactory::shared_pointer const & channelProviderFactory) EPICS_DEPRECATED;
|
||||
//! Shorthand for getChannelProviderRegistry()->clear();
|
||||
epicsShareFunc void unregisterAllChannelProviderFactory() EPICS_DEPRECATED;
|
||||
#ifdef __GNUC__
|
||||
|
||||
#define gCPRMSG __attribute__((error("ChannelProvider shared_ptr ownership rules have changed.")))
|
||||
|
||||
epicsShareFunc ChannelProviderRegistry::shared_pointer getChannelProviderRegistry() gCPRMSG;
|
||||
// Shorthand for getChannelProviderRegistry()->add(channelProviderFactory);
|
||||
epicsShareFunc void registerChannelProviderFactory(ChannelProviderFactory::shared_pointer const & channelProviderFactory) gCPRMSG;
|
||||
// Shorthand for getChannelProviderRegistry()->remove(channelProviderFactory);
|
||||
epicsShareFunc void unregisterChannelProviderFactory(ChannelProviderFactory::shared_pointer const & channelProviderFactory) gCPRMSG;
|
||||
// Shorthand for getChannelProviderRegistry()->clear();
|
||||
epicsShareFunc void unregisterAllChannelProviderFactory() gCPRMSG;
|
||||
|
||||
#undef gCPRMSG
|
||||
|
||||
#endif // __GNUC__
|
||||
|
||||
/**
|
||||
* @brief Pipeline (streaming) support API (optional).
|
||||
|
||||
@@ -156,50 +156,13 @@ void ChannelProviderRegistry::clear()
|
||||
providers.clear();
|
||||
}
|
||||
|
||||
struct CompatRegistry : public ChannelProviderRegistry
|
||||
{
|
||||
CompatRegistry() {}
|
||||
virtual ~CompatRegistry() {}
|
||||
virtual ChannelProviderFactory::shared_pointer getFactory(std::string const & providerName) OVERRIDE FINAL
|
||||
{
|
||||
ChannelProviderFactory::shared_pointer ret(clients()->getFactory(providerName));
|
||||
if(!ret)
|
||||
ret = servers()->getFactory(providerName);
|
||||
return ret;
|
||||
}
|
||||
virtual void getProviderNames(std::set<std::string>& names) OVERRIDE FINAL
|
||||
{
|
||||
clients()->getProviderNames(names);
|
||||
servers()->getProviderNames(names);
|
||||
}
|
||||
virtual bool add(const ChannelProviderFactory::shared_pointer& fact, bool replace=true) OVERRIDE FINAL
|
||||
{
|
||||
std::cerr<<"Warning: Adding provider \""<<fact->getFactoryName()<<"\" to compatibility ChannelProviderFactory is deprecated\n"
|
||||
<<" Instead explicitly add to ChannelProviderRegistry::clients() or ChannelProviderRegistry::servers()\n";
|
||||
// intentionally not using short-circuit or
|
||||
return clients()->add(fact, replace) | servers()->add(fact, replace);
|
||||
}
|
||||
virtual bool remove(const ChannelProviderFactory::shared_pointer& factory) OVERRIDE FINAL
|
||||
{
|
||||
// intentionally not using short-circuit or
|
||||
return clients()->remove(factory) | servers()->remove(factory);
|
||||
}
|
||||
virtual void clear() OVERRIDE FINAL
|
||||
{
|
||||
clients()->clear();
|
||||
servers()->clear();
|
||||
}
|
||||
};
|
||||
|
||||
namespace {
|
||||
struct providerRegGbl_t {
|
||||
ChannelProviderRegistry::shared_pointer clients,
|
||||
servers,
|
||||
compat;
|
||||
servers;
|
||||
providerRegGbl_t()
|
||||
:clients(ChannelProviderRegistry::build())
|
||||
,servers(ChannelProviderRegistry::build())
|
||||
,compat(new CompatRegistry)
|
||||
{}
|
||||
} *providerRegGbl;
|
||||
|
||||
@@ -226,28 +189,6 @@ ChannelProviderRegistry::shared_pointer ChannelProviderRegistry::servers()
|
||||
return providerRegGbl->servers;
|
||||
}
|
||||
|
||||
ChannelProviderRegistry::shared_pointer getChannelProviderRegistry()
|
||||
{
|
||||
epicsThreadOnce(&providerRegOnce, &providerRegInit, 0);
|
||||
|
||||
return providerRegGbl->compat;
|
||||
}
|
||||
|
||||
void registerChannelProviderFactory(ChannelProviderFactory::shared_pointer const & channelProviderFactory) {
|
||||
assert(channelProviderFactory);
|
||||
getChannelProviderRegistry()->add(channelProviderFactory);
|
||||
}
|
||||
|
||||
void unregisterChannelProviderFactory(ChannelProviderFactory::shared_pointer const & channelProviderFactory) {
|
||||
assert(channelProviderFactory);
|
||||
getChannelProviderRegistry()->remove(channelProviderFactory->getFactoryName());
|
||||
}
|
||||
|
||||
epicsShareFunc void unregisterAllChannelProviderFactory()
|
||||
{
|
||||
getChannelProviderRegistry()->clear();
|
||||
}
|
||||
|
||||
ChannelFind::shared_pointer
|
||||
ChannelProvider::channelList(ChannelListRequester::shared_pointer const & requester)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user