14#include "arcane/utils/Iostream.h"
15#include "arcane/utils/Collection.h"
16#include "arcane/utils/Enumerator.h"
17#include "arcane/utils/String.h"
18#include "arcane/utils/ITraceMng.h"
19#include "arcane/utils/CriticalSection.h"
21#include "arcane/core/IServiceLoader.h"
22#include "arcane/core/IServiceMng.h"
23#include "arcane/core/ISubDomain.h"
24#include "arcane/core/Service.h"
25#include "arcane/core/IModuleFactory.h"
26#include "arcane/core/IModule.h"
28#include "arcane/core/ServiceInfo.h"
29#include "arcane/core/IService.h"
53 ~ServiceLoader()
override;
95arcaneCreateServiceLoader()
108 trace->
log() <<
"Loading Application Services";
119 trace->
log() <<
"Loading Session Services";
130 trace->
log() <<
"Loading SubDomain Services";
152 if (instance.
get()) {
154 tm->
info() <<
"WARNING: singleton service loading'"
155 << si->
localName() <<
"' which is not specified as singleton.";
159 if (instance.
get()) {
162 VersionInfo vi = si->
version();
164 tm->
log() <<
"Loading singleton service " << local_name
165 <<
" (Version " << vi <<
")"
166 <<
" (Type " <<
typeid(instance.
get()).name() <<
")"
167 <<
" N=" << implemented_interfaces.count();
169 tm->
log() <<
" (Interface implemented '" << *sc <<
"'";
187 const bool do_all =
true;
195 if (old_instance.
get()) {
196 trace->
warning() <<
"An instance of singleton service; name: '" << name <<
"' already exists."
197 <<
" The second instance will not be created !";
213 auto instance = _createSingletonInstance(service_mng, si, sbi);
243 _createSingletonInstance(service_mng, si, sbib);
264 trace->
info() <<
"Loading module " <<
module->name()
265 << " (Version " << module->versionInfo() << ")"
266 << ((is_autoload) ? " (autoload)" : " ");
EnumeratorT< String > Enumerator
Critical section in multi-thread.
virtual ModuleFactoryInfoCollection moduleFactoryInfos()=0
List of module factory information.
virtual ServiceFactory2Collection serviceFactories2()=0
List of service factories.
virtual ITraceMng * traceMng() const =0
Trace manager.
virtual IServiceMng * serviceMng() const =0
Service manager.
Information about a module factory.
virtual void initializeModuleFactory(ISubDomain *sub_domain)=0
If the factory is a one-to-one module, initializes it on the sub-domain sub_domain.
virtual Ref< IModule > createModule(ISubDomain *parent, const MeshHandle &mesh_handle)=0
Creates a module.
virtual bool isAutoload() const =0
Indicates if the module should be loaded automatically.
Information about a service factory.
virtual bool isAutoload() const =0
true if the service is a module and must be loaded automatically
virtual bool isSingleton() const =0
true if the service is a singleton service (a single instance)
Interface for service or module information.
virtual String localName() const =0
Local part of the service name.
virtual IServiceFactoryInfo * factoryInfo() const =0
Information on factories available for this service.
virtual VersionInfo version() const =0
Service version.
virtual Internal::ISingletonServiceFactory * singletonFactory() const =0
Factory for singleton services (nullptr if not supported).
virtual StringCollection implementedInterfaces() const =0
List of names of classes implemented by this service.
Service loading interface.
Service manager interface.
virtual SingletonServiceInstanceRef singletonServiceReference(const String &name) const =0
virtual ITraceMng * traceMng() const =0
Associated trace manager.
virtual void addSingletonInstance(SingletonServiceInstanceRef sv)=0
Adds a reference to the service sv.
Interface for a case execution session.
virtual IApplication * application() const =0
Application.
Interface of the subdomain manager.
virtual IThreadMng * threadMng()=0
Returns the thread manager.
virtual IApplication * application()=0
Application.
virtual const MeshHandle & defaultMeshHandle()=0
Handle for the default mesh.
virtual TraceMessage warning()=0
Stream for a warning message.
virtual TraceMessage log()=0
Stream for a log message.
virtual TraceMessage info()=0
Stream for an information message.
virtual IServiceInfo * serviceInfo() const =0
Returns the IServiceInfo associated with this factory.
virtual Ref< ISingletonServiceInstance > createSingletonServiceInstance(const ServiceBuildInfoBase &sbi)=0
Create an instance of a singleton service.
InstanceType * get() const
Associated instance or nullptr if none.
Reference to an instance.
Information for creating a service.
IBase * serviceParent() const
Access to the parent instance that created this instance.
Service loader in the architecture.
void loadApplicationServices(IApplication *) override
Loads available application services.
void _loadServices(IApplication *application, const ServiceBuildInfoBase &sbib)
Loads services in the base manager.
void loadSubDomainServices(ISubDomain *parent) override
Loads available subdomain services in the subdomain sd.
void loadSessionServices(ISession *) override
Loads available session services.
bool loadSingletonService(ISubDomain *sd, const String &name) override
Loads the subdomain singleton service with name name.
void initializeModuleFactories(ISubDomain *sd) override
Calls the initialization methods for module factories.
void loadModules(ISubDomain *sd, bool all_modules) override
Loads available modules.
Unicode character string.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Collection< String > StringCollection
Collection of strings.
Collection< Internal::IServiceFactory2 * > ServiceFactory2Collection
Collection of service factories.
Ref< ISingletonServiceInstance > SingletonServiceInstanceRef
Reference to the 'ISingletonServiceInstance' interface.
Collection< IModuleFactoryInfo * > ModuleFactoryInfoCollection
Collection of module factory information.