Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
IService.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2026 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 of a 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/*!
31 * \brief Interface of a service.
32 *
33 * The instances returned by serviceInfo() and serviceParent() are the
34 * property of the application (IApplication interface) and must never
35 * be modified or destroyed.
36 *
37 * \deprecated
38 */
39class ARCANE_CORE_EXPORT IService
40{
41 protected:
42
43 //! Constructor
45
46 public:
47
48 virtual ~IService() {} //!< Releases resources
49
50 public:
51
52 //! Parent of this service
53 virtual IBase* serviceParent() const = 0;
54
55 //! Interface of this service (normally this)
56 virtual IService* serviceInterface() = 0;
57
58 //! Service information
59 virtual IServiceInfo* serviceInfo() const = 0;
60};
61
62/*---------------------------------------------------------------------------*/
63/*---------------------------------------------------------------------------*/
64
65/*!
66 * \brief Interface of a service instance.
67 */
68class ARCANE_CORE_EXPORT IServiceInstance
69{
70 friend class Ref<IServiceInstance>;
71
72 protected:
73
74 virtual ~IServiceInstance() = default;
75
76 public:
77
78 //! Adds a reference.
79 virtual void addReference() = 0;
80 //! Removes a reference.
81 virtual void removeReference() = 0;
82 virtual IServiceInfo* serviceInfo() const = 0;
83 //! \internal
84 virtual Internal::ExternalRef _internalDotNetHandle() const { return {}; }
85};
86
87/*---------------------------------------------------------------------------*/
88/*---------------------------------------------------------------------------*/
89
90/*!
91 * \internal
92 * \brief Interface of a singleton service instance.
93 */
94class ARCANE_CORE_EXPORT ISingletonServiceInstance
95: public IServiceInstance
96{
97 public:
98
99 //! List of instances of interfaces implemented by the singleton
101};
102
103/*---------------------------------------------------------------------------*/
104/*---------------------------------------------------------------------------*/
105/*!
106 * \internal
107 * \brief Typed interface managing a service instance.
108 */
109template <typename InterfaceType>
111: public IServiceInstance
112{
113 public:
114
115 virtual Ref<InterfaceType> instance() = 0;
116};
117
118/*---------------------------------------------------------------------------*/
119/*---------------------------------------------------------------------------*/
120
121} // namespace Arcane
122
123/*---------------------------------------------------------------------------*/
124/*---------------------------------------------------------------------------*/
125
126#endif
Declarations of Arcane's general types.
Interface of the base class for main arcane objects.
Definition IBase.h:32
Interface for service or module information.
Interface of a service instance.
Definition IService.h:69
virtual void removeReference()=0
Removes a reference.
virtual void addReference()=0
Adds a reference.
virtual IBase * serviceParent() const =0
Parent of this service.
virtual ~IService()
Releases resources.
Definition IService.h:48
IService()
Constructor.
Definition IService.h:44
virtual IServiceInfo * serviceInfo() const =0
Service information.
virtual IService * serviceInterface()=0
Interface of this service (normally this).
virtual ServiceInstanceCollection interfaceInstances()=0
List of instances of interfaces implemented by the singleton.
Reference to an instance.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Collection< ServiceInstanceRef > ServiceInstanceCollection
Collection of service instances.