Arcane  v3.14.10.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
ServiceMng.cc
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2022 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7/*---------------------------------------------------------------------------*/
8/* ServiceMng.cc (C) 2000-2013 */
9/* */
10/* Classe gérant l'ensemble des services. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/utils/ArcanePrecomp.h"
15
16#include "arcane/utils/List.h"
17#include "arcane/utils/PlatformUtils.h"
18#include "arcane/utils/String.h"
19#include "arcane/utils/Ref.h"
20#include "arccore/base/ReferenceCounter.h"
21
22#include "arcane/IBase.h"
23#include "arcane/IServiceMng.h"
24#include "arcane/IService.h"
25#include "arcane/IServiceInfo.h"
26#include "arcane/ServiceInstance.h"
27
28/*---------------------------------------------------------------------------*/
29/*---------------------------------------------------------------------------*/
30
31ARCANE_BEGIN_NAMESPACE
32
33/*---------------------------------------------------------------------------*/
34/*---------------------------------------------------------------------------*/
39: public IServiceMng
40{
41 public:
42
45
46 public:
47
48 ITraceMng* traceMng() const override { return m_base->traceMng(); }
49
51 {
52 m_singleton_instances.add(sv);
53 }
54
56 {
57 return m_singleton_instances;
58 }
59
60 SingletonServiceInstanceRef singletonServiceReference(const String& name) const override;
61
62 private:
63
66
67 private:
68
69 void onServicesChanged(const CollectionEventArgs& args);
70};
71
72/*---------------------------------------------------------------------------*/
73/*---------------------------------------------------------------------------*/
74
75extern "C++" IServiceMng*
76arcaneCreateServiceMng(IBase* b)
77{
78 return new ServiceMng(b);
79}
80
81/*---------------------------------------------------------------------------*/
82/*---------------------------------------------------------------------------*/
83
84ServiceMng::
85ServiceMng(IBase* b)
86: m_base(b)
87{
88}
89
90/*---------------------------------------------------------------------------*/
91/*---------------------------------------------------------------------------*/
92
93ServiceMng::
94~ServiceMng()
95{
96}
97
98/*---------------------------------------------------------------------------*/
99/*---------------------------------------------------------------------------*/
100
102singletonServiceReference(const String& name) const
103{
105 IServiceInstance* si = sr.get();
106 if (si){
107 IServiceInfo* sii = si->serviceInfo();
108 if (sii && sii->localName()==name)
109 return sr;
110 }
111 }
112 return {};
113}
114
115/*---------------------------------------------------------------------------*/
116/*---------------------------------------------------------------------------*/
117
118void ServiceMng::
119onServicesChanged(const CollectionEventArgs& args)
120{
121 ARCANE_UNUSED(args);
122}
123
124/*---------------------------------------------------------------------------*/
125/*---------------------------------------------------------------------------*/
126
127ARCANE_END_NAMESPACE
128
129/*---------------------------------------------------------------------------*/
130/*---------------------------------------------------------------------------*/
131
Arguments d'un évènement envoyé par une collection.
Interface de la classe de base des objets principaux arcane.
Definition IBase.h:38
Interface des informations d'un service ou d'un module.
Interface d'une instance d'un service.
Definition IService.h:73
Interface du gestionnaire de services.
Definition IServiceMng.h:31
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Definition Lima.cc:120
Gestionnaire des services.
Definition ServiceMng.cc:40
ITraceMng * traceMng() const override
Gestionnaire de trace associé
Definition ServiceMng.cc:48
IBase * m_base
Gestionnaire principal.
Definition ServiceMng.cc:64
SingletonServiceInstanceRef singletonServiceReference(const String &name) const override
List< SingletonServiceInstanceRef > m_singleton_instances
Liste des instances singletons.
Definition ServiceMng.cc:65
SingletonServiceInstanceCollection singletonServices() const override
Retourne la liste des services singleton.
Definition ServiceMng.cc:55
void addSingletonInstance(SingletonServiceInstanceRef sv) override
Ajoute une référence au service sv.
Definition ServiceMng.cc:50
Interface du gestionnaire de traces.
Référence à une instance.
Chaîne de caractères unicode.