RSC  0.12.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Registry.h File Reference
#include <iostream>
#include <map>
#include <set>
#include <stdexcept>
#include <string>
#include <boost/noncopyable.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/static_assert.hpp>
#include <boost/thread/recursive_mutex.hpp>
#include "rsc/config.h"
#include "rsc/rscexports.h"
#include "../misc/langutils.h"
Include dependency graph for Registry.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 rsc
 
 rsc::misc
 

Macros

#define CREATE_GLOBAL_REGISTREE(registry, registree, uniqueName)
 Creates an object that globally registers in the Registry. More...
 
#define CREATE_GLOBAL_REGISTREE_MSG(registry, registree, uniqueName, msg)
 Creates an object that globally registers in the Registry. More...
 

Functions

template<class R >
class rsc::misc::DEPRECATED_CLASS ("If possible, use rsc::patterns::Factory instead") Registry
 A templatized global registry. More...
 
 rsc::misc::DEPRECATED_MSG (void addRegistree(R *r, const std::string &errorDescription=""),"If possible, use rsc::patterns::Factory instead")
 Registers a new registree in the Registry. More...
 
 rsc::misc::DEPRECATED_MSG (boost::shared_ptr< R > getRegistree(const std::string &key),"If possible, use rsc::patterns::Factory instead")
 Returns the registree for the provided key. More...
 
 rsc::misc::DEPRECATED_MSG (std::set< std::string > getKnownRegistryKeys(),"If possible, use rsc::patterns::Factory instead")
 Returns a set with all known registree keys. More...
 
 rsc::misc::DEPRECATED_MSG (bool removeRegistree(const std::string &name),"If possible, use rsc::patterns::Factory instead")
 Removes a registree from this registry. More...
 
 rsc::misc::DEPRECATED_MSG (boost::recursive_mutex *getMutex(),"If possible, use rsc::patterns::Factory instead")
 Returns a recursive mutex that can be used to make multiple operations on this class atomic. More...
 

Variables

boost::recursive_mutex rsc::misc::mutex
 
std::map< std::string,
boost::shared_ptr< R > > 
rsc::misc::registreesByName
 

Macro Definition Documentation

#define CREATE_GLOBAL_REGISTREE (   registry,
  registree,
  uniqueName 
)
Value:
class Starter##uniqueName { \
public: \
Starter##uniqueName() { \
(registry)->addRegistree(registree); \
} \
}; \
Starter##uniqueName uniqueName##Starter;

Creates an object that globally registers in the Registry.

This method only works directly in binaries or shared libraries, no static libraries.

Class names for this macro must be given without namespaces and templates. Create typedefs as required to match these restrictions.

Note
be aware of the static initialization order fiasco and do not return static members for the registry key
Parameters
registryregistry to register in
registreeregistree to register
uniqueNamea unique name to generate a register function

Definition at line 182 of file Registry.h.

#define CREATE_GLOBAL_REGISTREE_MSG (   registry,
  registree,
  uniqueName,
  msg 
)
Value:
class Starter##uniqueName { \
public: \
Starter##uniqueName() { \
(registry)->addRegistree(registree, msg); \
} \
}; \
Starter##uniqueName uniqueName##Starter;

Creates an object that globally registers in the Registry.

This method only works directly in binaries or shared libraries, no static libraries.

Class names for this macro must be given without namespaces and templates. Create typedefs as required to match these restrictions.

Note
be aware of the static initialization order fiasco and do not return static members for the registry key
Parameters
registryregistry to register in
registreeregistree to register
msgerror message to display on registration failure
uniqueNamea unique name to generate a register function

Definition at line 205 of file Registry.h.