Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
SharedReference.cc
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/* SharedReference.cc (C) 2000-2022 */
9/* */
10/* Reference counter. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/utils/Iostream.h"
15
16#include "arcane/core/SharedReference.h"
17
18/*---------------------------------------------------------------------------*/
19/*---------------------------------------------------------------------------*/
20
21namespace Arcane
22{
23
24/*---------------------------------------------------------------------------*/
25/*---------------------------------------------------------------------------*/
26
28addRef()
29{
30 ++m_ref_count;
31}
32
33/*---------------------------------------------------------------------------*/
34/*---------------------------------------------------------------------------*/
35
38{
39 Int32 r = --m_ref_count;
40 // Since this method might be called from a destructor, it must not
41 // throw an exception
42 if (r < 0)
44 if (r == 0)
45 deleteMe();
46}
47
48/*---------------------------------------------------------------------------*/
49/*---------------------------------------------------------------------------*/
50
51} // End namespace Arcane
52
53/*---------------------------------------------------------------------------*/
54/*---------------------------------------------------------------------------*/
virtual void deleteMe()=0
Destroys the referenced object.
void addRef() override
Increments the reference counter.
void removeRef() override
Decrements the reference counter.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
void arcaneNoReferenceErrorCallTerminate(const void *ptr)
Use of an unreferenced object.
Definition Misc.cc:167
std::int32_t Int32
Signed integer type of 32 bits.