Arcane
v3.16.8.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
ServiceInstance.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
/* ServiceInstance.h (C) 2000-2025 */
9
/* */
10
/* Instance de service. */
11
/*---------------------------------------------------------------------------*/
12
#ifndef ARCANE_CORE_SERVICEINSTANCE_H
13
#define ARCANE_CORE_SERVICEINSTANCE_H
14
/*---------------------------------------------------------------------------*/
15
/*---------------------------------------------------------------------------*/
16
17
#include "arcane/utils/Ref.h"
18
#include "arcane/core/IService.h"
19
20
/*---------------------------------------------------------------------------*/
21
/*---------------------------------------------------------------------------*/
22
23
namespace
Arcane
24
{
25
26
/*---------------------------------------------------------------------------*/
27
/*---------------------------------------------------------------------------*/
34
class
ARCANE_CORE_EXPORT ServiceInstanceRef
35
{
36
typedef
Ref<IServiceInstance>
RefType;
37
private
:
38
ServiceInstanceRef(
const
RefType& r) : m_instance(r){}
39
public
:
40
ServiceInstanceRef() =
default
;
41
public
:
42
static
ServiceInstanceRef createRef(
IServiceInstance
* p)
43
{
44
return
ServiceInstanceRef(
RefType::create
(p));
45
}
46
static
ServiceInstanceRef createRefNoDestroy(
IServiceInstance
* p)
47
{
48
return
ServiceInstanceRef(RefType::_createNoDestroy(p));
49
}
50
static
ServiceInstanceRef createWithHandle(
IServiceInstance
* p,
Internal::ExternalRef
handle)
51
{
52
return
ServiceInstanceRef(
RefType::createWithHandle
(p,handle));
53
}
54
public
:
55
IServiceInstance
* get()
const
{
return
m_instance.get(); }
56
void
reset() { m_instance.reset(); }
57
private
:
58
RefType m_instance;
59
};
60
61
/*---------------------------------------------------------------------------*/
62
/*---------------------------------------------------------------------------*/
63
64
inline
bool
operator==(
const
ServiceInstanceRef
& a,
const
ServiceInstanceRef
& b)
65
{
66
return
a.get()==b.get();
67
}
68
69
inline
bool
operator!=(
const
ServiceInstanceRef& a,
const
ServiceInstanceRef& b)
70
{
71
return
a.get()!=b.get();
72
}
73
74
/*---------------------------------------------------------------------------*/
75
/*---------------------------------------------------------------------------*/
76
77
}
// End namespace Arcane
78
79
/*---------------------------------------------------------------------------*/
80
/*---------------------------------------------------------------------------*/
81
82
#endif
Arcane::IServiceInstance
Interface d'une instance d'un service.
Definition
IService.h:67
Arcane::Internal::ExternalRef
Gestion des références sur un objet externe.
Definition
arccore/src/base/arccore/base/ExternalRef.h:45
Arcane::Ref
Référence à une instance.
Definition
arccore/src/base/arccore/base/Ref.h:143
Arcane::Ref< IServiceInstance >::createWithHandle
static ThatClass createWithHandle(IServiceInstance *t, Internal::ExternalRef handle)
Definition
arccore/src/base/arccore/base/Ref.h:256
Arcane::Ref< IServiceInstance >::create
static ThatClass create(IServiceInstance *t)
Definition
arccore/src/base/arccore/base/Ref.h:238
Arcane::ServiceInstanceRef
Référence sur une instance de service.
Definition
ServiceInstance.h:35
Arcane
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
Definition
AcceleratorGlobal.h:36
arcane
core
ServiceInstance.h
Généré le Lundi 8 Septembre 2025 02:53:00 pour Arcane par
1.13.2