12#ifndef ARCANE_UTILS_COLLECTION_H
13#define ARCANE_UTILS_COLLECTION_H
17#include "arcane/utils/AutoRef.h"
18#include "arcane/utils/CollectionImpl.h"
32class ARCANE_UTILS_EXPORT CollectionBase
40 CollectionBase(
const CollectionBase& rhs)
53 CollectionBase& operator=(
const CollectionBase& rhs)
68 void clear() { m_ref->clear(); }
74 CollectionChangeEventHandler&
change() {
return m_ref->change(); }
78 Impl* _ref() {
return m_ref.get(); }
79 const Impl* _ref()
const {
return m_ref.get(); }
84 Arcane::arcaneCheckNull(m_ref.get());
88 const Impl* _noNullRef()
const
91 Arcane::arcaneCheckNull(m_ref.get());
96 void _setRef(Impl* new_impl)
103 AutoRefT<Impl> m_ref;
114:
public CollectionBase
122 typedef const T& ObjectRef;
154 Iterator begin() {
return _cast().begin(); }
155 Iterator end() {
return _cast().end(); }
156 Ref front() {
return *begin(); }
160 bool remove(ObjectRef value) {
return _cast().remove(value); }
161 void removeAt(
Integer index) {
return _cast().removeAt(index); }
162 void add(ObjectRef value) { _cast().add(value); }
163 bool contains(ObjectRef value)
const {
return _cast().contains(value); }
168 template <
class Function> Function
169 each(Function f) {
return _cast().each(f); }
173 Impl& _cast() {
return *
static_cast<Impl*
>(_noNullRef()); }
174 const Impl& _cast()
const {
return *
static_cast<const Impl*
>(_ref()); }
Classe de base d'une collection.
void clear()
Supprime tous les éléments de la collection.
Integer count() const
Nombre d'éléments de la collection.
bool empty() const
True si la collection est vide.
CollectionChangeEventHandler & change()
Evènement invoqués lorsque la collection change.
CollectionBase()=default
Créé une collection nulle.
EnumeratorT< IModule * > Enumerator
Function each(Function f)
Applique le fonctor f à tous les éléments de la collection.
Collection()=default
Créé une collection nulle.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
Int32 Integer
Type représentant un entier.