Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
Arcane::ServiceRegisterer Class Reference

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 ServicePropertyproperty () const
 Service properties.
const ServicePropertyserviceProperty () const
 Properties in the case of a service.
const ModulePropertymoduleProperty () const
 Properties in the case of a module.
ServiceRegistererpreviousService () const
 Previous service (0 if the first).
ServiceRegisterernextService () const
 Next service (0 if the last).

Static Public Member Functions

static ServiceRegistererfirstService ()
 Access to the first element of the service registrar chain.
static Integer nbService ()
 Number of service registrars in the chain.

Detailed Description

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.

Member Typedef Documentation

◆ ModuleFactoryWithPropertyFunc

typedef IModuleFactoryInfo *(* Arcane::ServiceRegisterer::ModuleFactoryWithPropertyFunc) (const ModuleProperty &properties)

Definition at line 52 of file ServiceRegisterer.h.

◆ ServiceInfoWithPropertyCreateFunc

typedef IServiceInfo *(* Arcane::ServiceRegisterer::ServiceInfoWithPropertyCreateFunc) (const ServiceProperty &properties)

Definition at line 53 of file ServiceRegisterer.h.

Constructor & Destructor Documentation

◆ ServiceRegisterer() [1/2]

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().

◆ ServiceRegisterer() [2/2]

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.

Member Function Documentation

◆ firstService()

ServiceRegisterer * Arcane::ServiceRegisterer::firstService ( )
static

Access to the first element of the service registrar chain.

Definition at line 109 of file ServiceRegisterer.cc.

References ServiceRegisterer().

◆ infoCreatorWithPropertyFunction()

ServiceInfoWithPropertyCreateFunc Arcane::ServiceRegisterer::infoCreatorWithPropertyFunction ( )
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.

◆ moduleFactoryWithPropertyFunction()

ModuleFactoryWithPropertyFunc Arcane::ServiceRegisterer::moduleFactoryWithPropertyFunction ( )
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.

◆ moduleProperty()

const ModuleProperty & Arcane::ServiceRegisterer::moduleProperty ( ) const
inline

Properties in the case of a module.

Definition at line 103 of file ServiceRegisterer.h.

◆ name()

const char * Arcane::ServiceRegisterer::name ( )
inline

Service name.

Definition at line 90 of file ServiceRegisterer.h.

◆ nbService()

Integer Arcane::ServiceRegisterer::nbService ( )
static

Number of service registrars in the chain.

Definition at line 118 of file ServiceRegisterer.cc.

◆ nextService()

ServiceRegisterer * Arcane::ServiceRegisterer::nextService ( ) const
inline

Next service (0 if the last).

Definition at line 109 of file ServiceRegisterer.h.

References ServiceRegisterer().

◆ previousService()

ServiceRegisterer * Arcane::ServiceRegisterer::previousService ( ) const
inline

Previous service (0 if the first).

Definition at line 106 of file ServiceRegisterer.h.

References ServiceRegisterer().

◆ property()

ARCANE_DEPRECATED_260 const ServiceProperty & Arcane::ServiceRegisterer::property ( ) const
inline

Service properties.

Deprecated
Use serviceProperty() instead

Definition at line 97 of file ServiceRegisterer.h.

◆ serviceProperty()

const ServiceProperty & Arcane::ServiceRegisterer::serviceProperty ( ) const
inline

Properties in the case of a service.

Definition at line 100 of file ServiceRegisterer.h.


The documentation for this class was generated from the following files: