Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
Arcane::CollectionImplBase Class Referenceabstract

Base class for collection implementation. More...

#include </__w/arcaneframework.github.io/arcaneframework.github.io/framework/arccore/src/common/arccore/common/Collection.h>

Inheritance diagram for Arcane::CollectionImplBase:
Collaboration diagram for Arcane::CollectionImplBase:

Public Types

typedef Integer size_type
 Type indexing the array.
typedef ptrdiff_t difference_type
 Type of a distance between array iterator elements.

Public Member Functions

 CollectionImplBase ()=default
 Constructs an empty collection.
 CollectionImplBase (Integer acount)
 Constructs a collection with acount elements.
 CollectionImplBase (const CollectionImplBase &from)=delete
 Copy constructor. event handlers are not copied.
Integer count () const
 Returns the number of elements in the collection.
virtual void clear ()=0
 Removes all elements from the collection.
virtual void onClear ()
 Event sent before removing all elements.
virtual void onClearComplete ()
 Event sent when all elements have been removed.
virtual void onInsert ()
 Event sent before inserting an element.
virtual void onInsertComplete (void *object, Integer position)
 Event sent after inserting an element.
virtual void onRemove ()
 Event sent before removing an element.
virtual void onRemoveComplete (void *object, Integer position)
 Event sent after removing an element.
virtual void onSet ()
virtual void onSetComplete (void *object, Integer position)
virtual void onValidate ()
virtual EnumeratorImplBaseenumerator () const =0
 Returns a generic enumerator for the collection.
CollectionChangeEventHandler & change ()
Public Member Functions inherited from Arcane::ObjectImpl
 ObjectImpl (const ObjectImpl &rhs)=delete
ObjectImpl & operator= (const ObjectImpl &rhs)=delete
void addRef ()
 Increments the reference counter.
void removeRef ()
 Decrements the reference counter.
Int32 refCount () const
 Returns the value of the reference counter.
virtual void deleteMe ()
 Destroys this object.

Protected Member Functions

void _setCount (Integer acount)

Private Member Functions

void _sendEvent (CollectionEventArgs::eAction action, void *object, Integer position)

Private Attributes

Integer m_count = 0
CollectionChangeEventHandler m_collection_handlers

Detailed Description

Base class for collection implementation.

A collection is an object containing elements (i.e., a container).

It is possible to iterate over the elements of a collection using an enumerator obtained via enumerator(). The enumerator obtained this way is generic regardless of the collection type. It is therefore less performant than an enumerator dedicated to a type, and it is better to use the latter if possible.

A collection generates events when elements are removed, inserted, or modified. It is possible to register a handler to receive these events using change().

Constant operations are threadsafe.

This class is intended to be derived for each implementation of a collection.

See also
EnumeratorImpl

Definition at line 327 of file arccore/src/common/arccore/common/Collection.h.

Member Typedef Documentation

◆ difference_type

Type of a distance between array iterator elements.

Definition at line 335 of file arccore/src/common/arccore/common/Collection.h.

◆ size_type

Constructor & Destructor Documentation

◆ CollectionImplBase()

Arcane::CollectionImplBase::CollectionImplBase ( Integer acount)
inlineexplicit

Constructs a collection with acount elements.

Definition at line 342 of file arccore/src/common/arccore/common/Collection.h.

Member Function Documentation

◆ _sendEvent()

void Arcane::CollectionImplBase::_sendEvent ( CollectionEventArgs::eAction action,
void * object,
Integer position )
inlineprivate

◆ _setCount()

void Arcane::CollectionImplBase::_setCount ( Integer acount)
inlineprotected

◆ change()

CollectionChangeEventHandler & Arcane::CollectionImplBase::change ( )
inline

◆ clear()

virtual void Arcane::CollectionImplBase::clear ( )
pure virtual

Removes all elements from the collection.

Implemented in Arcane::ListImplBase< T >.

◆ count()

Integer Arcane::CollectionImplBase::count ( ) const
inline

Returns the number of elements in the collection.

Definition at line 352 of file arccore/src/common/arccore/common/Collection.h.

Referenced by Arcane::ListImplBase< T >::add(), Arcane::ListImplBase< T >::end(), Arcane::ListImplBase< T >::end(), and Arcane::ListImplBase< T >::end2().

Here is the caller graph for this function:

◆ enumerator()

virtual EnumeratorImplBase * Arcane::CollectionImplBase::enumerator ( ) const
pure virtual

Returns a generic enumerator for the collection.

Implemented in Arcane::ListImplBase< T >.

◆ onClear()

virtual void Arcane::CollectionImplBase::onClear ( )
inlinevirtual

Event sent before removing all elements.

Definition at line 359 of file arccore/src/common/arccore/common/Collection.h.

Referenced by Arcane::ListImplBase< T >::clear().

Here is the caller graph for this function:

◆ onClearComplete()

virtual void Arcane::CollectionImplBase::onClearComplete ( )
inlinevirtual

Event sent when all elements have been removed.

Definition at line 361 of file arccore/src/common/arccore/common/Collection.h.

Referenced by Arcane::ListImplBase< T >::clear().

Here is the caller graph for this function:

◆ onInsert()

virtual void Arcane::CollectionImplBase::onInsert ( )
inlinevirtual

Event sent before inserting an element.

Definition at line 366 of file arccore/src/common/arccore/common/Collection.h.

Referenced by Arcane::ListImplBase< T >::add().

Here is the caller graph for this function:

◆ onInsertComplete()

virtual void Arcane::CollectionImplBase::onInsertComplete ( void * object,
Integer position )
inlinevirtual

Event sent after inserting an element.

Definition at line 368 of file arccore/src/common/arccore/common/Collection.h.

Referenced by Arcane::ListImplBase< T >::add().

Here is the caller graph for this function:

◆ onRemove()

virtual void Arcane::CollectionImplBase::onRemove ( )
inlinevirtual

Event sent before removing an element.

Definition at line 373 of file arccore/src/common/arccore/common/Collection.h.

◆ onRemoveComplete()

virtual void Arcane::CollectionImplBase::onRemoveComplete ( void * object,
Integer position )
inlinevirtual

Event sent after removing an element.

Definition at line 375 of file arccore/src/common/arccore/common/Collection.h.

◆ onSet()

virtual void Arcane::CollectionImplBase::onSet ( )
inlinevirtual

◆ onSetComplete()

virtual void Arcane::CollectionImplBase::onSetComplete ( void * object,
Integer position )
inlinevirtual

◆ onValidate()

virtual void Arcane::CollectionImplBase::onValidate ( )
inlinevirtual

Member Data Documentation

◆ m_collection_handlers

CollectionChangeEventHandler Arcane::CollectionImplBase::m_collection_handlers
private

◆ m_count

Integer Arcane::CollectionImplBase::m_count = 0
private

The documentation for this class was generated from the following file: