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

Service and module registrar. More...

#include <arcane/core/ServiceRegisterer.h>

Collaboration diagram for Arcane::ServiceRegisterer:

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.

Private Member Functions

void setPreviousService (ServiceRegisterer *s)
 Positions the previous service.
void setNextService (ServiceRegisterer *s)
 Positions the next service.
void _init ()

Private Attributes

ModuleFactoryWithPropertyFunc m_module_factory_with_property_functor = nullptr
 Function to create the IModuleFactory.
ServiceInfoWithPropertyCreateFunc m_info_function_with_property = nullptr
 Function to create the IServiceInfo.
const char * m_name = nullptr
 Service name.
ServiceProperty m_service_property
 Service properties.
ModuleProperty m_module_property
 Module properties.
ServiceRegistererm_previous = nullptr
 Previous service.
ServiceRegistererm_next = nullptr
 Next service.

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.

References m_info_function_with_property, m_module_factory_with_property_functor, m_module_property, m_name, m_next, m_previous, and m_service_property.

Referenced by firstService(), nextService(), previousService(), setNextService(), and setPreviousService().

Here is the caller graph for this function:

◆ 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.

References m_info_function_with_property, m_module_factory_with_property_functor, m_module_property, m_name, m_next, m_previous, and m_service_property.

Member Function Documentation

◆ _init()

void Arcane::ServiceRegisterer::_init ( )
private

Definition at line 71 of file ServiceRegisterer.cc.

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

Referenced by Arcane::ServiceAndModuleFactoryMng::createAllServiceRegistererFactories().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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.

References m_info_function_with_property.

Referenced by Arcane::ServiceAndModuleFactoryMng::_addFactoryFromServiceRegisterer().

Here is the caller graph for this function:

◆ 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.

References m_module_factory_with_property_functor.

Referenced by Arcane::ServiceAndModuleFactoryMng::_addFactoryFromServiceRegisterer().

Here is the caller graph for this function:

◆ moduleProperty()

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

Properties in the case of a module.

Definition at line 103 of file ServiceRegisterer.h.

References m_module_property.

Referenced by Arcane::ServiceAndModuleFactoryMng::_addFactoryFromServiceRegisterer().

Here is the caller graph for this function:

◆ name()

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

Service name.

Definition at line 90 of file ServiceRegisterer.h.

References m_name.

Referenced by Arcane::ServiceAndModuleFactoryMng::_addFactoryFromServiceRegisterer(), and Arcane::ServiceAndModuleFactoryMng::createAllServiceRegistererFactories().

Here is the caller graph for this function:

◆ nbService()

Integer Arcane::ServiceRegisterer::nbService ( )
static

Number of service registrars in the chain.

Definition at line 118 of file ServiceRegisterer.cc.

Referenced by Arcane::ServiceAndModuleFactoryMng::createAllServiceRegistererFactories().

Here is the caller graph for this function:

◆ nextService()

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

Next service (0 if the last).

Definition at line 109 of file ServiceRegisterer.h.

References m_next, and ServiceRegisterer().

Referenced by Arcane::ServiceAndModuleFactoryMng::createAllServiceRegistererFactories().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ previousService()

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

Previous service (0 if the first).

Definition at line 106 of file ServiceRegisterer.h.

References m_previous, and ServiceRegisterer().

Here is the call graph for this function:

◆ 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.

References m_service_property.

◆ serviceProperty()

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

Properties in the case of a service.

Definition at line 100 of file ServiceRegisterer.h.

References m_service_property.

Referenced by Arcane::ServiceAndModuleFactoryMng::_addFactoryFromServiceRegisterer().

Here is the caller graph for this function:

◆ setNextService()

void Arcane::ServiceRegisterer::setNextService ( ServiceRegisterer * s)
inlineprivate

Positions the next service.

Used internally to build the service chain

Definition at line 119 of file ServiceRegisterer.h.

References m_next, and ServiceRegisterer().

Here is the call graph for this function:

◆ setPreviousService()

void Arcane::ServiceRegisterer::setPreviousService ( ServiceRegisterer * s)
inlineprivate

Positions the previous service.

Used internally to build the service chain

Definition at line 115 of file ServiceRegisterer.h.

References m_previous, and ServiceRegisterer().

Here is the call graph for this function:

Member Data Documentation

◆ m_info_function_with_property

ServiceInfoWithPropertyCreateFunc Arcane::ServiceRegisterer::m_info_function_with_property = nullptr
private

Function to create the IServiceInfo.

Definition at line 134 of file ServiceRegisterer.h.

Referenced by infoCreatorWithPropertyFunction(), ServiceRegisterer(), and ServiceRegisterer().

◆ m_module_factory_with_property_functor

ModuleFactoryWithPropertyFunc Arcane::ServiceRegisterer::m_module_factory_with_property_functor = nullptr
private

Function to create the IModuleFactory.

Definition at line 132 of file ServiceRegisterer.h.

Referenced by moduleFactoryWithPropertyFunction(), ServiceRegisterer(), and ServiceRegisterer().

◆ m_module_property

ModuleProperty Arcane::ServiceRegisterer::m_module_property
private

Module properties.

Definition at line 140 of file ServiceRegisterer.h.

Referenced by moduleProperty(), ServiceRegisterer(), and ServiceRegisterer().

◆ m_name

const char* Arcane::ServiceRegisterer::m_name = nullptr
private

Service name.

Definition at line 136 of file ServiceRegisterer.h.

Referenced by name(), ServiceRegisterer(), and ServiceRegisterer().

◆ m_next

ServiceRegisterer* Arcane::ServiceRegisterer::m_next = nullptr
private

Next service.

Definition at line 144 of file ServiceRegisterer.h.

Referenced by nextService(), ServiceRegisterer(), ServiceRegisterer(), and setNextService().

◆ m_previous

ServiceRegisterer* Arcane::ServiceRegisterer::m_previous = nullptr
private

Previous service.

Definition at line 142 of file ServiceRegisterer.h.

Referenced by previousService(), ServiceRegisterer(), ServiceRegisterer(), and setPreviousService().

◆ m_service_property

ServiceProperty Arcane::ServiceRegisterer::m_service_property
private

Service properties.

Definition at line 138 of file ServiceRegisterer.h.

Referenced by property(), serviceProperty(), ServiceRegisterer(), and ServiceRegisterer().


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