Service and module registrar. More...
#include <arcane/core/ServiceRegisterer.h>
Public Types | |
| typedef IModuleFactoryInfo *(* | ModuleFactoryWithPropertyFunc) (const ModuleProperty &properties) |
| typedef IServiceInfo *(* | ServiceInfoWithPropertyCreateFunc) (const ServiceProperty &properties) |
Public Member Functions | |
| ServiceRegisterer (ServiceInfoWithPropertyCreateFunc func, const ServiceProperty &properties) ARCANE_NOEXCEPT | |
| Creates a registrar for the service name and the function func. | |
| ServiceRegisterer (ModuleFactoryWithPropertyFunc func, const ModuleProperty &properties) ARCANE_NOEXCEPT | |
| Creates a registrar for the module name with properties properties. | |
| ServiceInfoWithPropertyCreateFunc | infoCreatorWithPropertyFunction () |
| Creation function for the 'ServiceInfo' instance if it is a service. | |
| ModuleFactoryWithPropertyFunc | moduleFactoryWithPropertyFunction () |
| Creation function for the factory if it is a module. | |
| const char * | name () |
| Service name. | |
| ARCANE_DEPRECATED_260 const ServiceProperty & | property () const |
| Service properties. | |
| const ServiceProperty & | serviceProperty () const |
| Properties in the case of a service. | |
| const ModuleProperty & | moduleProperty () const |
| Properties in the case of a module. | |
| ServiceRegisterer * | previousService () const |
| Previous service (0 if the first). | |
| ServiceRegisterer * | nextService () const |
| Next service (0 if the last). | |
Static Public Member Functions | |
| static ServiceRegisterer * | firstService () |
| Access to the first element of the service registrar chain. | |
| static Integer | nbService () |
| Number of service registrars in the chain. | |
Service and module registrar.
This class implements the Singleton pattern for a given service.
It allows declaring a global variable that automatically registers the IServiceFactory of the desired service. This class is not used directly but through the ARCANE_DEFINE_SERVICE(name) macro.
Since this class is used with global instances, they are constructed before the code enters main(). Therefore, extreme care must be taken not to use any objects or perform allocations (in particular, the service name must be a standard const char*). For this purpose, the list of registered services is maintained in a linked list, and each instance contains pointers to the next and previous members of the list. The first element of the list is obtained by calling ServiceRegisterer::firstService().
Definition at line 48 of file ServiceRegisterer.h.
| typedef IModuleFactoryInfo *(* Arcane::ServiceRegisterer::ModuleFactoryWithPropertyFunc) (const ModuleProperty &properties) |
Definition at line 52 of file ServiceRegisterer.h.
| typedef IServiceInfo *(* Arcane::ServiceRegisterer::ServiceInfoWithPropertyCreateFunc) (const ServiceProperty &properties) |
Definition at line 53 of file ServiceRegisterer.h.
| Arcane::ServiceRegisterer::ServiceRegisterer | ( | ServiceInfoWithPropertyCreateFunc | func, |
| const ServiceProperty & | properties ) |
Creates a registrar for the service name and the function func.
This constructor is used to register a service.
Definition at line 37 of file ServiceRegisterer.cc.
Referenced by firstService(), nextService(), and previousService().
| Arcane::ServiceRegisterer::ServiceRegisterer | ( | ModuleFactoryWithPropertyFunc | func, |
| const ModuleProperty & | properties ) |
Creates a registrar for the module name with properties properties.
This constructor is used to register a module.
Definition at line 54 of file ServiceRegisterer.cc.
|
static |
Access to the first element of the service registrar chain.
Definition at line 109 of file ServiceRegisterer.cc.
References ServiceRegisterer().
|
inline |
Creation function for the 'ServiceInfo' instance if it is a service.
This pointer may be null if it is not a service, in which case infoCreatorFunction() must be used.
Definition at line 79 of file ServiceRegisterer.h.
|
inline |
Creation function for the factory if it is a module.
This pointer may be null if it is not a module, in which case infoCreatorFunction() must be used.
Definition at line 87 of file ServiceRegisterer.h.
|
inline |
Properties in the case of a module.
Definition at line 103 of file ServiceRegisterer.h.
|
inline |
Service name.
Definition at line 90 of file ServiceRegisterer.h.
|
static |
Number of service registrars in the chain.
Definition at line 118 of file ServiceRegisterer.cc.
|
inline |
Next service (0 if the last).
Definition at line 109 of file ServiceRegisterer.h.
References ServiceRegisterer().
|
inline |
Previous service (0 if the first).
Definition at line 106 of file ServiceRegisterer.h.
References ServiceRegisterer().
|
inline |
Service properties.
Definition at line 97 of file ServiceRegisterer.h.
|
inline |
Properties in the case of a service.
Definition at line 100 of file ServiceRegisterer.h.