Arcane  4.1.12.0
Developer 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
39class ARCANE_CORE_EXPORT IService
40{
41 protected:
42
45
46 public:
47
48 virtual ~IService() {}
49
50 public:
51
53 virtual IBase* serviceParent() const = 0;
54
56 virtual IService* serviceInterface() = 0;
57
59 virtual IServiceInfo* serviceInfo() const = 0;
60};
61
62/*---------------------------------------------------------------------------*/
63/*---------------------------------------------------------------------------*/
64
68class ARCANE_CORE_EXPORT IServiceInstance
69{
70 friend class Ref<IServiceInstance>;
71
72 protected:
73
74 virtual ~IServiceInstance() = default;
75
76 public:
77
79 virtual void addReference() = 0;
81 virtual void removeReference() = 0;
82 virtual IServiceInfo* serviceInfo() const = 0;
84 virtual Internal::ExternalRef _internalDotNetHandle() const { return {}; }
85};
86
87/*---------------------------------------------------------------------------*/
88/*---------------------------------------------------------------------------*/
89
94class ARCANE_CORE_EXPORT ISingletonServiceInstance
95: public IServiceInstance
96{
97 public:
98
101};
102
103/*---------------------------------------------------------------------------*/
104/*---------------------------------------------------------------------------*/
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.
Typed interface managing a service instance.
Definition IService.h:112
Interface of a service instance.
Definition IService.h:69
virtual Internal::ExternalRef _internalDotNetHandle() const
Definition IService.h:84
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).
Interface of a singleton service instance.
Definition IService.h:96
virtual ServiceInstanceCollection interfaceInstances()=0
List of instances of interfaces implemented by the singleton.
Management of references to an external object.
Reference to an instance.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Collection< ServiceInstanceRef > ServiceInstanceCollection
Collection of service instances.