35 #include <boost/noncopyable.hpp>
36 #include <boost/shared_ptr.hpp>
37 #include <boost/static_assert.hpp>
38 #include <boost/thread/recursive_mutex.hpp>
40 #include "rsc/config.h"
41 #include "rsc/rscexports.h"
43 #include "../misc/langutils.h"
80 DEPRECATED_MSG(
void addRegistree(R* r,
const std::string& errorDescription =
""),
81 "If possible, use rsc::patterns::Factory instead") {
83 boost::recursive_mutex::scoped_lock lock(
mutex);
86 throw std::invalid_argument(
87 "There already is a registree with key '"
88 + r->getRegistryKey() +
"'. " + errorDescription);
103 "If possible, use rsc::patterns::Factory instead") {
105 boost::recursive_mutex::scoped_lock lock(
mutex);
107 typename std::map<std::string, boost::shared_ptr<R> >::const_iterator it =
110 throw std::invalid_argument(
111 "There is no registree with key '" + key +
"'.");
124 "If possible, use rsc::patterns::Factory instead") {
126 boost::recursive_mutex::scoped_lock lock(
mutex);
128 std::set<std::string> keys;
129 typename std::map<std::string, boost::shared_ptr<R> >::const_iterator it;
132 keys.insert(it->first);
146 "If possible, use rsc::patterns::Factory instead") {
147 boost::recursive_mutex::scoped_lock lock(
mutex);
158 "If possible, use rsc::patterns::Factory instead") {
182 #define CREATE_GLOBAL_REGISTREE(registry, registree, uniqueName) \
183 class Starter##uniqueName { \
185 Starter##uniqueName() { \
186 (registry)->addRegistree(registree); \
189 Starter##uniqueName uniqueName##Starter;
205 #define CREATE_GLOBAL_REGISTREE_MSG(registry, registree, uniqueName, msg) \
206 class Starter##uniqueName { \
208 Starter##uniqueName() { \
209 (registry)->addRegistree(registree, msg); \
212 Starter##uniqueName uniqueName##Starter;
std::map< std::string, boost::shared_ptr< R > > registreesByName
Objects of this class manage a family of named implementations of a particular interface.
DEPRECATED_MSG(void addRegistree(R *r, const std::string &errorDescription=""),"If possible, use rsc::patterns::Factory instead")
Registers a new registree in the Registry.
class DEPRECATED_CLASS("If possible, use rsc::patterns::Factory instead") Registry
A templatized global registry.
boost::recursive_mutex mutex