12#ifndef ARCANE_CORE_MODULEFACTORY_H
13#define ARCANE_CORE_MODULEFACTORY_H
17#include "arcane/core/IServiceFactory.h"
18#include "arcane/core/IModuleFactory.h"
19#include "arcane/core/ServiceRegisterer.h"
20#include "arcane/core/ModuleBuildInfo.h"
21#include "arcane/core/IServiceInfo.h"
22#include "arcane/core/ModuleProperty.h"
59 void addReference()
override;
60 void removeReference()
override;
62 bool isAutoload()
const override {
return m_is_autoload; }
63 void initializeModuleFactory(
ISubDomain* sub_domain)
override;
72 std::atomic<Int32> m_nb_ref;
82class ARCANE_CORE_EXPORT ModuleFactory2
88 : m_service_info(service_info)
92 ~ModuleFactory2()
override;
101 return m_service_info;
119template <
class ModuleType>
121:
public ModuleFactory2
126 : ModuleFactory2(service_info, name)
138 ModuleType::staticInitialize(sd);
171#define ARCANE_REGISTER_MODULE(class_name, a_module_properties) \
172 extern "C++" ARCANE_EXPORT Arcane::IModuleFactoryInfo* \
173 ARCANE_JOIN_WITH_LINE(arcaneCreateModuleFactory##class_name)(const Arcane::ModuleProperty& properties) \
175 const char* module_name = properties.name(); \
176 Arcane::ServiceProperty sp(module_name, 0); \
177 auto* si = Arcane::Internal::ServiceInfo::create(sp, __FILE__, __LINE__); \
178 Arcane::IModuleFactory2* mf = new Arcane::ModuleFactory2T<class_name>(si, module_name); \
179 return new Arcane::ModuleFactory(Arcane::makeRef(mf), properties.isAutoload()); \
181 Arcane::ServiceRegisterer ARCANE_EXPORT ARCANE_JOIN_WITH_LINE(globalModuleRegisterer##class_name)(&ARCANE_JOIN_WITH_LINE(arcaneCreateModuleFactory##class_name), a_module_properties)
192#define ARCANE_REGISTER_AXL_MODULE(class_name, a_module_properties) \
193 extern "C++" ARCANE_EXPORT Arcane::IModuleFactoryInfo* \
194 ARCANE_JOIN_WITH_LINE(arcaneCreateModuleFactory##class_name)(const Arcane::ModuleProperty& properties) \
196 const char* module_name = properties.name(); \
197 Arcane::ServiceProperty sp(module_name, 0); \
198 auto* si = Arcane::Internal::ServiceInfo::create(sp, __FILE__, __LINE__); \
199 class_name ::fillServiceInfo(si); \
200 Arcane::IModuleFactory2* mf = new Arcane::ModuleFactory2T<class_name>(si, module_name); \
201 return new Arcane::ModuleFactory(Arcane::makeRef(mf), properties.isAutoload()); \
203 Arcane::ServiceRegisterer ARCANE_EXPORT ARCANE_JOIN_WITH_LINE(globalModuleRegisterer##class_name)(&ARCANE_JOIN_WITH_LINE(arcaneCreateModuleFactory##class_name), a_module_properties)
216#define ARCANE_DEFINE_STANDARD_MODULE(class_name, module_name) \
217 ARCANE_REGISTER_MODULE(class_name, Arcane::ModuleProperty(#module_name))
This file contains the various types and classes for specifying service properties.
Module factory interface (V2).
Information about a module factory.
Interface for service or module information.
Interface of the subdomain manager.
Information for building a module.
Ref< IModule > createModuleInstance(ISubDomain *sd, const MeshHandle &mesh_handle) override
Creates a module instance.
void initializeModuleFactory(ISubDomain *sd) override
Static initialization of the module.
String moduleName() const override
Name of the module created by this factory.
const IServiceInfo * serviceInfo() const override
Information about the module that can be created by this factory.
ModuleFactory(Ref< IModuleFactory2 > factory, bool is_autoload)
Constructs a factory for a module.
Ref< IModule > createModule(ISubDomain *parent, const MeshHandle &mesh_handle) override
Creates a module.
String moduleName() const override
Name of the module created by this factory.
bool isAutoload() const override
Indicates if the module should be loaded automatically.
Reference to an instance.
Unicode character string.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
auto makeRef(InstanceType *t) -> Ref< InstanceType >
Creates a reference on a pointer.