14#include "arccore/base/ReferenceCounter.h"
16#include "arcane/utils/TraceAccessor.h"
17#include "arcane/utils/List.h"
18#include "arcane/utils/OStringStream.h"
19#include "arcane/utils/FatalErrorException.h"
20#include "arcane/utils/VersionInfo.h"
21#include "arcane/utils/ITraceMng.h"
22#include "arcane/utils/Array.h"
24#include "arcane/core/ServiceUtils.h"
25#include "arcane/core/ServiceInfo.h"
26#include "arcane/core/ServiceRegisterer.h"
27#include "arcane/core/IServiceFactory.h"
28#include "arcane/core/IModuleFactory.h"
29#include "arcane/core/ModuleProperty.h"
30#include "arcane/core/IServiceAndModuleFactoryMng.h"
46class ARCANE_IMPL_EXPORT ServiceAndModuleFactoryMng
56 ServiceAndModuleFactoryMng(
ITraceMng* tm);
57 virtual ~ServiceAndModuleFactoryMng();
72 std::set<ServiceRegisterer*> m_service_registerer_done_set;
107 if (m_service_factory_set.find(sfi) != m_service_factory_set.end()) {
108 std::cout <<
"Service Factory is already referenced\n";
111 m_service_factory_set.insert(sfi);
124 if (m_module_factory_set.find(mfi) != m_module_factory_set.end()) {
125 std::cout <<
"Module Factory is already referenced\n";
128 m_module_factory_set.insert(mfi);
154 std::set<IServiceFactoryInfo*> m_service_factory_set;
155 std::set<IModuleFactoryInfo*> m_module_factory_set;
162arcaneCreateServiceAndModuleFactoryMng(
ITraceMng* tm)
171ServiceAndModuleFactoryMng::
198 return m_p->serviceFactoryInfos();
207 return m_p->serviceFactories2();
216 return m_p->moduleFactoryInfos();
227 m_p->addServiceFactory(sfi,
false);
238 m_p->addModuleFactory(mfi);
249 log() <<
"WARNING: No registered service";
252 std::set<ServiceRegisterer*> registered_services;
259 if (registered_services.find(sr) == registered_services.end()) {
260 oss() <<
"\t" << sr->
name() <<
'\n';
261 registered_services.insert(sr);
264 cout <<
"=== Registered service factories ===\n"
266 <<
"====================================\n"
268 <<
"====================================" << endl;
298 if (m_service_registerer_done_set.find(sr) != m_service_registerer_done_set.end())
300 m_service_registerer_done_set.insert(sr);
308 m_p->addModuleFactory(mfi);
315 if (!property_info_func)
316 ARCANE_FATAL(
"Null PropertyFunc for ServiceRegisterer");
320 ARCANE_FATAL(
"Null ServiceInfo created by ServiceRegisterer");
323 m_p->registerServiceInfoForDelete(si);
328 m_p->addServiceFactory(sfi,
true);
335 info() <<
"WARNING: ServiceRegisterer does not have a valid create function name=" << sr->
name();
#define ARCANE_CHECK_POINTER2(ptr, text)
Macro returning the pointer ptr if it is not null or throwing an exception if it is null.
#define ARCANE_FATAL(...)
Macro throwing a FatalErrorException.
EnumeratorT< Internal::IServiceFactory2 * > Enumerator
Information about a module factory.
virtual String moduleName() const =0
Name of the module created by this factory.
Interface of a service and module factory manager.
Information about a service factory.
virtual IServiceInfo * serviceInfo() const =0
Information about the service that can be created by this factory.
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 ServiceFactory2Collection factories() const =0
List of service factories.
Implementation of a collection of elements in vector form.
ListEnumeratorT< T > Enumerator
Type of a constant iterator over the entire array.
Reference counter for a module factory.
Output stream linked to a String.
List< IServiceFactoryInfo * > m_service_factory_infos
List of service factory information.
UniqueArray< IServiceFactoryInfo * > m_deletable_service_factory_list
List of IServiceFactoryInfo to be destroyed.
List< IModuleFactoryInfo * > m_module_factory_infos
List of module factory information.
UniqueArray< ModuleFactoryReference > m_deletable_module_factory_list
List of IModuleFactoryInfo to be destroyed.
List< Internal::IServiceFactory2 * > m_service_factories2
List of service factory information (V2).
List< IServiceInfo * > m_service_infos
List of service information.
virtual ServiceFactoryInfoCollection serviceFactoryInfos() const
List of information about service factories.
void _addFactoryFromServiceRegisterer(ServiceRegisterer *sr)
Adds the factory specified by sr.
virtual void addGlobalFactory(IServiceFactoryInfo *sfi)
Adds the service factory sfi. sfi must not be destroyed while this instance is in use....
virtual ~ServiceAndModuleFactoryMng()
Destroys the manager.
virtual ModuleFactoryInfoCollection moduleFactoryInfos() const
List of service factories.
virtual void createAllServiceRegistererFactories()
Creates all factories associated with a ServiceRegisterer.
virtual ServiceFactory2Collection serviceFactories2() const
List of information about module factories.
Service and module registrar.
static ServiceRegisterer * firstService()
Access to the first element of the service registrar chain.
ServiceRegisterer * nextService() const
Next service (0 if the last).
const ServiceProperty & serviceProperty() const
Properties in the case of a service.
const char * name()
Service name.
ModuleFactoryWithPropertyFunc moduleFactoryWithPropertyFunction()
Creation function for the factory if it is a module.
ServiceInfoWithPropertyCreateFunc infoCreatorWithPropertyFunction()
Creation function for the 'ServiceInfo' instance if it is a service.
static Integer nbService()
Number of service registrars in the chain.
const ModuleProperty & moduleProperty() const
Properties in the case of a module.
TraceAccessor(ITraceMng *m)
Constructs an accessor via the trace manager m.
TraceMessage log() const
Flow for a log message.
TraceMessage info() const
Flow for an information message.
1D data vector with value semantics (STL style).
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Collection< IServiceFactoryInfo * > ServiceFactoryInfoCollection
Collection of service factory information.
Collection< Internal::IServiceFactory2 * > ServiceFactory2Collection
Collection of service factories.
Collection< IModuleFactoryInfo * > ModuleFactoryInfoCollection
Collection of module factory information.