Arcane
v3.16.2.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-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
/* ServiceInstance.h (C) 2000-2019 */
9
/* */
10
/* Instance de service. */
11
/*---------------------------------------------------------------------------*/
12
#ifndef ARCANE_SERVICEINSTANCE_H
13
#define ARCANE_SERVICEINSTANCE_H
14
/*---------------------------------------------------------------------------*/
15
/*---------------------------------------------------------------------------*/
16
17
#include "arcane/utils/Ref.h"
18
#include "arcane/IService.h"
19
20
/*---------------------------------------------------------------------------*/
21
/*---------------------------------------------------------------------------*/
22
23
namespace
Arcane
24
{
25
26
/*---------------------------------------------------------------------------*/
27
/*---------------------------------------------------------------------------*/
28
29
/*---------------------------------------------------------------------------*/
30
/*---------------------------------------------------------------------------*/
37
class
ARCANE_CORE_EXPORT ServiceInstanceRef
38
{
39
typedef
Ref<IServiceInstance>
RefType;
40
private
:
41
ServiceInstanceRef(
const
RefType& r) : m_instance(r){}
42
public
:
43
ServiceInstanceRef() =
default
;
44
public
:
45
static
ServiceInstanceRef createRef(
IServiceInstance
* p)
46
{
47
return
ServiceInstanceRef(
RefType::create
(p));
48
}
49
static
ServiceInstanceRef createRefNoDestroy(
IServiceInstance
* p)
50
{
51
return
ServiceInstanceRef(RefType::_createNoDestroy(p));
52
}
53
static
ServiceInstanceRef createWithHandle(
IServiceInstance
* p,
Internal::ExternalRef
handle)
54
{
55
return
ServiceInstanceRef(
RefType::createWithHandle
(p,handle));
56
}
57
public
:
58
IServiceInstance
* get()
const
{
return
m_instance.get(); }
59
void
reset() { m_instance.reset(); }
60
private
:
61
RefType m_instance;
62
};
63
64
/*---------------------------------------------------------------------------*/
65
/*---------------------------------------------------------------------------*/
66
67
inline
bool
operator==(
const
ServiceInstanceRef
& a,
const
ServiceInstanceRef
& b)
68
{
69
return
a.get()==b.get();
70
}
71
72
inline
bool
operator!=(
const
ServiceInstanceRef& a,
const
ServiceInstanceRef& b)
73
{
74
return
a.get()!=b.get();
75
}
76
77
/*---------------------------------------------------------------------------*/
78
/*---------------------------------------------------------------------------*/
79
80
}
// End namespace Arcane
81
82
/*---------------------------------------------------------------------------*/
83
/*---------------------------------------------------------------------------*/
84
85
#endif
Arcane::IServiceInstance
Interface d'une instance d'un service.
Definition
IService.h:73
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:38
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 Mercredi 23 Avril 2025 06:44:42 pour Arcane par
1.13.2