12#ifndef ARCCORE_BASE_REFDECLARATIONS_H
13#define ARCCORE_BASE_REFDECLARATIONS_H
17#include "arccore/base/ArccoreGlobal.h"
38class ReferenceCounterImpl;
42template <
typename InstanceType>
43class ReferenceCounterWrapper;
70constexpr int REF_TAG_SHARED_PTR = 0;
71constexpr int REF_TAG_REFERENCE_COUNTER = 1;
78template<
typename InstanceType,
class T =
void>
81 static constexpr int TagId = REF_TAG_SHARED_PTR;
90template<
typename InstanceType>
91struct RefTraits<InstanceType,std::enable_if_t<std::is_same_v<typename InstanceType::ReferenceCounterTagType,ReferenceCounterTag>>>
93 static constexpr int TagId = REF_TAG_REFERENCE_COUNTER;
96template<
typename InstanceType,
103template<
typename InstanceType,
int TagType>
112template <
typename T,
typename =
int>
124template <
typename T,
typename =
int>
150 static void addReference(T* t)
153 t->_internalAddReference();
157 static void removeReference(T* t)
160 bool need_destroy = t->_internalRemoveReference();
165 t->removeReference();
176 static ARCCORE_EXPORT
void addReference(T* t);
177 static ARCCORE_EXPORT
void removeReference(T* t);
205#define ARCCORE_DECLARE_REFERENCE_COUNTED_INCLASS_METHODS() \
207 template<typename T> friend class Arccore::ExternalReferenceCounterAccessor; \
208 template<typename T> friend class Arccore::ReferenceCounterAccessor;\
210 using ReferenceCounterTagType = Arccore::ReferenceCounterTag ; \
211 virtual ::Arccore::ReferenceCounterImpl* _internalReferenceCounter() =0; \
212 virtual void _internalAddReference() =0;\
213 [[nodiscard]] virtual bool _internalRemoveReference() =0
237#define ARCCORE_DECLARE_REFERENCE_COUNTED_CLASS(class_name) \
240struct RefTraits<class_name> \
242 static constexpr int TagId = Arccore::REF_TAG_REFERENCE_COUNTER;\
245class ReferenceCounterAccessor<class_name>\
246: public ExternalReferenceCounterAccessor<class_name>\
Référence à une instance.
Accesseur des méthodes de gestion de compteurs de référence.
Espace de nom de Arccore.
Caractéristiques pour gérer les compteurs de référence.
Structure servant à tagger les interfaces/classes qui utilisent un compteur de référence interne.
Classe template pour vérifier si T a la méthode _internalAddReference()
Classe template pour vérifier si T a la méthode _internalRemoveReference()