Arcane  v3.14.10.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
23namespace Arcane
24{
25
26/*---------------------------------------------------------------------------*/
27/*---------------------------------------------------------------------------*/
28
29/*---------------------------------------------------------------------------*/
30/*---------------------------------------------------------------------------*/
37class ARCANE_CORE_EXPORT ServiceInstanceRef
38{
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
67inline bool operator==(const ServiceInstanceRef& a,const ServiceInstanceRef& b)
68{
69 return a.get()==b.get();
70}
71
72inline 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
Interface d'une instance d'un service.
Definition IService.h:73
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Definition Lima.cc:120
Référence sur une instance de service.
Gestion des références sur un objet externe.
Référence à une instance.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-