Arcane  v3.16.6.0
Documentation utilisateur
Chargement...
Recherche...
Aucune correspondance
IService.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2025 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/* IService.h (C) 2000-2025 */
9/* */
10/* Interface d'un service. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_CORE_ISERVICE_H
13#define ARCANE_CORE_ISERVICE_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
18
19#include "arcane/utils/ExternalRef.h"
20
21/*---------------------------------------------------------------------------*/
22/*---------------------------------------------------------------------------*/
23
24namespace Arcane
25{
26
27/*---------------------------------------------------------------------------*/
28/*---------------------------------------------------------------------------*/
29/*!
30 * \brief Interface d'un service.
31 *
32 * Les instances retournées par serviceInfo() et serviceParent() sont la
33 * propriété de l'application (interface IApplication) et ne doivent jamais
34 * être modifiée ni détruite.
35 *
36 * \deprecated
37 */
38class ARCANE_CORE_EXPORT IService
39{
40 protected:
41
42 //! Constructeur
44
45 public:
46
47 virtual ~IService() {} //!< Libère les ressources
48
49 public:
50
51 //! Parent de ce service
52 virtual IBase* serviceParent() const = 0;
53
54 //! Interface de ce service (normalement this)
55 virtual IService* serviceInterface() = 0;
56
57 //! Informations du service
58 virtual IServiceInfo* serviceInfo() const = 0;
59};
60
61/*---------------------------------------------------------------------------*/
62/*---------------------------------------------------------------------------*/
63/*!
64 * \brief Interface d'une instance d'un service.
65 */
66class ARCANE_CORE_EXPORT IServiceInstance
67{
68 friend class Ref<IServiceInstance>;
69
70 protected:
71
72 virtual ~IServiceInstance() = default;
73
74 public:
75
76 //! Ajoute une référence.
77 virtual void addReference() = 0;
78 //! Supprime une référence.
79 virtual void removeReference() = 0;
80 virtual IServiceInfo* serviceInfo() const = 0;
81 //! \internal
82 virtual Internal::ExternalRef _internalDotNetHandle() const { return {}; }
83};
84
85/*---------------------------------------------------------------------------*/
86/*---------------------------------------------------------------------------*/
87/*!
88 * \internal
89 * \brief Interface d'une instance de service singleton.
90 */
91class ARCANE_CORE_EXPORT ISingletonServiceInstance
92: public IServiceInstance
93{
94 public:
95
96 //! Liste des instances des interfaces implémentées par le singleton
98};
99
100/*---------------------------------------------------------------------------*/
101/*---------------------------------------------------------------------------*/
102/*!
103 * \internal
104 * \brief Interface typée gérant l'instance d'un service.
105 */
106template <typename InterfaceType>
108: public IServiceInstance
109{
110 public:
111
112 virtual Ref<InterfaceType> instance() = 0;
113};
114
115/*---------------------------------------------------------------------------*/
116/*---------------------------------------------------------------------------*/
117
118} // namespace Arcane
119
120/*---------------------------------------------------------------------------*/
121/*---------------------------------------------------------------------------*/
122
123#endif
Déclarations des types généraux de Arcane.
Interface de la classe de base des objets principaux arcane.
Definition IBase.h:31
Interface des informations d'un service ou d'un module.
Interface d'une instance d'un service.
Definition IService.h:67
virtual void removeReference()=0
Supprime une référence.
virtual void addReference()=0
Ajoute une référence.
virtual IBase * serviceParent() const =0
Parent de ce service.
virtual ~IService()
Libère les ressources.
Definition IService.h:47
IService()
Constructeur.
Definition IService.h:43
virtual IServiceInfo * serviceInfo() const =0
Informations du service.
virtual IService * serviceInterface()=0
Interface de ce service (normalement this)
virtual ServiceInstanceCollection interfaceInstances()=0
Liste des instances des interfaces implémentées par le singleton.
Référence à une instance.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
Collection< ServiceInstanceRef > ServiceInstanceCollection
Collection d'instances de services.