Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
RefDeclarations.h File Reference
#include "arccore/base/BaseTypes.h"
#include <type_traits>
#include <memory>
Include dependency graph for RefDeclarations.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  Arccore::ExternalReferenceCounterAccessor< T >
struct  Arcane::ReferenceCounterTag
 Structure used to tag interfaces/classes that use an internal reference counter. More...
struct  Arcane::RefTraits< InstanceType >
 Characteristics for managing reference counters. More...
class  Arcane::ReferenceCounterAccessor< T >
 Accessor for reference counter management methods. More...
class  Arcane::ExternalReferenceCounterAccessor< T >
struct  Arccore::ReferenceCounterTag
 Structure used to tag interfaces/classes that use an internal reference counter. More...

Namespaces

namespace  Arccore
 Namespace of Arccore.
namespace  Arcane
 -- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --

Macros

#define ARCCORE_DECLARE_REFERENCE_COUNTED_INCLASS_METHODS()
 Macro to declare the virtual methods managing reference counters.
#define ARCCORE_DECLARE_REFERENCE_COUNTED_CLASS(class_name)
 Macro to declare that a class uses a reference counter.

Functions

constexpr int Arcane::arcaneImplGetRefTagId (void *)
 Function to determine what type of reference counter a class uses.

Variables

constexpr int Arcane::REF_TAG_SHARED_PTR = 0
constexpr int Arcane::REF_TAG_REFERENCE_COUNTER = 1

Detailed Description

This file contains the declarations and macros for managing classes using reference counters. For implementation, you must use the file 'ReferenceCounterImpl.h'

Definition in file RefDeclarations.h.

Macro Definition Documentation

◆ ARCCORE_DECLARE_REFERENCE_COUNTED_CLASS

#define ARCCORE_DECLARE_REFERENCE_COUNTED_CLASS ( class_name)
Value:
namespace Arcane \
{ \
template <> \
struct RefTraits<class_name> \
{ \
static constexpr int TagId = ::Arcane::REF_TAG_REFERENCE_COUNTER; \
}; \
constexpr inline int arcaneImplGetRefTagId(class_name*) \
{ \
return ::Arcane::REF_TAG_REFERENCE_COUNTER; \
} \
template <> \
class ReferenceCounterAccessor<class_name> \
: public ExternalReferenceCounterAccessor<class_name> \
{}; \
}
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --

Macro to declare that a class uses a reference counter.

The macro must be used outside of any namespace. For example:

namespace MyNamespace
{
class MyClass;
}
#define ARCCORE_DECLARE_REFERENCE_COUNTED_CLASS(class_name)
Macro to declare that a class uses a reference counter.

You will then need to use the macro ARCCORE_DEFINE_REFERENCE_COUNTED_CLASS() in the source file to define the necessary methods and types

Definition at line 219 of file RefDeclarations.h.

◆ ARCCORE_DECLARE_REFERENCE_COUNTED_INCLASS_METHODS

#define ARCCORE_DECLARE_REFERENCE_COUNTED_INCLASS_METHODS ( )
Value:
private: \
\
template <typename T> friend class ::Arccore::ExternalReferenceCounterAccessor; \
template <typename T> friend class Arcane::ReferenceCounterAccessor; \
\
public: \
\
using ReferenceCounterTagType = ::Arcane::ReferenceCounterTag; \
virtual ::Arcane::ReferenceCounterImpl* _internalReferenceCounter() = 0; \
virtual void _internalAddReference() = 0; \
[[nodiscard]] virtual bool _internalRemoveReference() = 0
Accessor for reference counter management methods.
Structure used to tag interfaces/classes that use an internal reference counter.

Macro to declare the virtual methods managing reference counters.

This macro is used in the same way as declarations of interface methods. It allows defining pure virtual methods to access reference counter information.

The class implementing the interface must use the macro ARCCORE_DEFINE_REFERENCE_COUNTED_INCLASS_METHODS() to define the virtual methods used.

class IMyInterface
{
public:
virtual ~IMyInterface() = default;
public:
virtual void myMethod1() = 0;
};
#define ARCCORE_DECLARE_REFERENCE_COUNTED_INCLASS_METHODS()
Macro to declare the virtual methods managing reference counters.

Definition at line 183 of file RefDeclarations.h.