12#ifndef ARCANE_UTILS_SHAREDPTR_H
13#define ARCANE_UTILS_SHAREDPTR_H
17#include "arcane/utils/Ptr.h"
18#include "arcane/utils/Atomic.h"
45 void addRef() { ++m_counter; }
46 void removeRef() { --m_counter; }
47 Int32 refCount()
const {
return m_counter.load(); }
51 std::atomic<Int32> m_counter;
75 _copy(
ptr.get(),
ptr.refCountPtr(),
ptr.explicitDelete());
79 template <
typename T2>
83 _copy(
ptr.get(),
ptr.refCountPtr(),
ptr.explicitDelete());
87 template <
typename T2>
95 template <
typename T2>
98 _copy(
dynamic_cast<T*
>(
ptr.get()),
ptr.refCountPtr(),
ptr.explicitDelete());
104 _copy(
ptr.get(),
ptr.refCountPtr(),
ptr.explicitDelete());
109 template <
typename T2>
113 _copy(
ptr.get(),
ptr.refCountPtr(),
ptr.explicitDelete());
117 bool isUnique()
const {
return (m_counter->refCount() == 1); }
118 Int32 refCount()
const {
return (m_counter) ? m_counter->refCount() : 0; }
119 bool isUsed()
const {
return (m_counter !=
NULL); }
124 m_counter->removeRef();
125 if (m_counter->refCount() == 0) {
127 delete BaseClass::m_value;
131 BaseClass::m_value = 0;
134 RefCounter* refCountPtr()
const {
return m_counter; }
135 bool explicitDelete()
const {
return m_free; }
161template <
typename T2,
typename T>
162SharedPtrT<T2> SPtr_dynamic_cast(
const SharedPtrT<T>& src)
164 return SharedPtrT<T2>(src,
true);
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Encapsulation d'un pointeur.
TraceAccessor & operator=(const TraceAccessor &rhs)
Opérateur de recopie.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-