Index

Package: Mutable_Lists (generic)

Description

generic
   type Element_Type is private;

   with function "="( left, right : Element_Type ) return Boolean is <>;

package Mutable_Lists is

Classes

List

type List is tagged limited private;

Primitive operations:

Append_No_Duplicate
Find_Next
Iterate_With_Quit

References:

mutable_lists.ads:55:10 (declaration)
events-corrals.ads:145:47 (reference)
events-corrals.ads:145:74 (reference)
events-manager.adb:84:43 (reference)
events-manager.adb:84:68 (reference)
mutable_lists.adb:7:37 (reference)
mutable_lists.adb:24:54 (reference)
mutable_lists.adb:54:36 (reference)
mutable_lists.adb:73:35 (reference)
mutable_lists.adb:97:44 (reference)
mutable_lists.adb:115:36 (reference)
mutable_lists.adb:133:38 (reference)
mutable_lists.adb:145:41 (reference)
mutable_lists.adb:164:51 (reference)
mutable_lists.adb:186:36 (reference)
mutable_lists.adb:198:38 (reference)
mutable_lists.adb:215:37 (reference)
mutable_lists.adb:245:59 (reference)
mutable_lists.ads:56:31 (reference)
mutable_lists.ads:59:37 (reference)
mutable_lists.ads:63:54 (reference)
mutable_lists.ads:68:36 (reference)
mutable_lists.ads:73:35 (reference)
mutable_lists.ads:77:36 (reference)
mutable_lists.ads:80:38 (reference)
mutable_lists.ads:85:41 (reference)
mutable_lists.ads:91:51 (reference)
mutable_lists.ads:96:36 (reference)
mutable_lists.ads:99:38 (reference)
mutable_lists.ads:103:37 (reference)
mutable_lists.ads:128:10 (full declaration)
mutable_lists.ads:135:44 (reference)
mutable_lists.ads:141:41 (reference)
A List is a thread-safe mutable list backed by doubly linked list. Mutable lists may be modified during iteration, so it is possible for a thread A to add to or remove elements from the list while a thread B is iterating across the list. However, elements which are being examined by a cursor or the Iterate procedure are locked to prevent other threads from modifying or removing elements referenced by cursors. Lists only support Append and Prepend additions. While the atomic list operations provided in this package are thread safe, there is no guarantee that the list will not be modified by a different thread between calls. For example, the following may fail: if list.Is_Empty then list.Append( element ); end if; Assert( not list.Is_Empty ); The list may be modified by other threads between the calls to Is_Empty and Append.

Types

Cursor

type Cursor is limited private;

References:

mutable_lists.ads:18:10 (declaration)
events-corrals.adb:374:31 (reference)
events-manager.adb:155:29 (reference)
mutable_lists.adb:73:80 (reference)
mutable_lists.adb:115:57 (reference)
mutable_lists.adb:147:20 (reference)
mutable_lists.adb:167:20 (reference)
mutable_lists.adb:215:61 (reference)
mutable_lists.adb:276:40 (reference)
mutable_lists.adb:292:34 (reference)
mutable_lists.adb:303:38 (reference)
mutable_lists.adb:310:39 (reference)
mutable_lists.ads:21:40 (reference)
mutable_lists.ads:25:34 (reference)
mutable_lists.ads:28:38 (reference)
mutable_lists.ads:32:39 (reference)
mutable_lists.ads:73:80 (reference)
mutable_lists.ads:77:57 (reference)
mutable_lists.ads:103:61 (reference)
mutable_lists.ads:139:10 (full declaration)
A Cursor references a location in a list. List elements referenced by cursors are locked and can only be examined via the open cursor referencing them. Any threads attempting to reference a locked list element will block until the element's cursor is closed. Note that while a List is thread safe, a Cursor is not.

A_List

type A_List is access all List'Class;

References:

mutable_lists.ads:56:10 (declaration)
mutable_lists.adb:243:37 (reference)
mutable_lists.adb:245:71 (reference)
mutable_lists.ads:107:37 (reference)

Constants & Global variables

Container_Error

Container_Error : exception;

References:

mutable_lists.ads:111:5 (declaration)
mutable_lists.adb:226:27 (reference)
mutable_lists.adb:229:23 (reference)
mutable_lists.adb:232:19 (reference)
mutable_lists.adb:255:23 (reference)
mutable_lists.adb:297:19 (reference)
mutable_lists.adb:316:19 (reference)
Raised when any kind of use error occurs while using a mutable list. See the exception occurence's message for details.

Subprograms & Entries

Close

procedure Close
( position: in out Cursor );

References:

mutable_lists.ads:21:15 (declaration)
mutable_lists.adb:154:9 (reference)
mutable_lists.adb:157:13 (reference)
mutable_lists.adb:176:9 (reference)
mutable_lists.adb:179:13 (reference)
mutable_lists.adb:276:15 (body)
mutable_lists.adb:288:9 (label)
Closes the cursor, unlocking the list element under examination.

Element

function Element
( position: Cursor )
return Element_Type;

References:

mutable_lists.ads:25:14 (declaration)
mutable_lists.adb:151:26 (reference)
mutable_lists.adb:172:26 (reference)
mutable_lists.adb:292:14 (body)
mutable_lists.adb:299:9 (label)
Returns the element referenced by the cursor. An exception is raised on error.

Has_Element

function Has_Element
( position: Cursor )
return Boolean;

References:

mutable_lists.ads:28:14 (declaration)
events-corrals.adb:377:27 (reference)
events-manager.adb:158:25 (reference)
mutable_lists.adb:150:15 (reference)
mutable_lists.adb:171:15 (reference)
mutable_lists.adb:218:12 (reference)
mutable_lists.adb:278:12 (reference)
mutable_lists.adb:294:12 (reference)
mutable_lists.adb:303:14 (body)
mutable_lists.adb:306:9 (label)
mutable_lists.adb:312:12 (reference)

Called by:

Close defined at mutable_lists.ads:21:15
Element defined at mutable_lists.ads:25:14
Events.Corrals.Remove defined at events-corrals.ads:174:15
Events.Manager.Unregister defined at events-manager.adb:154:15
Iterate defined at mutable_lists.ads:85:15
Iterate_With_Quit defined at mutable_lists.ads:91:15
Next defined at mutable_lists.ads:32:15
Remove defined at mutable_lists.ads:103:15
Returns True if the cursor is open, referencing an existing list element.

Next

procedure Next
( position: in out Cursor );

References:

mutable_lists.ads:32:15 (declaration)
mutable_lists.adb:152:13 (reference)
mutable_lists.adb:174:13 (reference)
mutable_lists.adb:310:15 (body)
mutable_lists.adb:318:9 (label)
Modifies the cursor to point to the next element in the list, blocking if the next element is already being examined.

Append

procedure Append
( this: access List;
element: Element_Type );

References:

mutable_lists.ads:59:15 (declaration)
mutable_lists.adb:7:15 (body)
mutable_lists.adb:19:9 (label)

Calls:

Ada.Containers.Doubly_Linked_Lists.Append defined at a-cdlili.ads:111:14
Delete defined at mutable_lists.ads:124:15
Locking_Objects.Locking_Object.Lock defined at locking_objects.ads:15:15
Locking_Objects.Locking_Object.Unlock defined at locking_objects.ads:20:19
Appends the element to the list.

Append_No_Duplicate

procedure Append_No_Duplicate
( this: access List;
element: Element_Type;
inserted: out Boolean );

References:

mutable_lists.ads:63:15 (declaration)
events-corrals.adb:307:24 (reference)
events-manager.adb:125:22 (reference)
mutable_lists.adb:24:15 (body)
mutable_lists.adb:49:9 (label)

Called by:

Events.Corrals.Add defined at events-corrals.ads:151:15
Events.Manager.Register defined at events-manager.adb:122:15

Calls:

= defined at mutable_lists.ads:8:18
Ada.Containers.Doubly_Linked_Lists.Append defined at a-cdlili.ads:111:14
Ada.Containers.Doubly_Linked_Lists.Element defined at a-cdlili.ads:67:13
Ada.Containers.Doubly_Linked_Lists.First defined at a-cdlili.ads:155:13
Ada.Containers.Doubly_Linked_Lists.Has_Element defined at a-cdlili.ads:185:13
Ada.Containers.Doubly_Linked_Lists.Next defined at a-cdlili.ads:165:14
Locking_Objects.Locking_Object.Lock defined at locking_objects.ads:15:15
Locking_Objects.Locking_Object.Unlock defined at locking_objects.ads:20:19
Appends the element to the list unless it's already in the list. Inserted will be returned as True if the append was performed.

Clear

procedure Clear
( this: access List );

References:

mutable_lists.ads:68:15 (declaration)
events-corrals.adb:358:24 (reference)
mutable_lists.adb:54:15 (body)
mutable_lists.adb:68:9 (label)

Called by:

Events.Corrals.Clear defined at events-corrals.ads:164:15

Calls:

Ada.Containers.Doubly_Linked_Lists.Clear defined at a-cdlili.ads:65:14
Ada.Containers.Doubly_Linked_Lists.Element defined at a-cdlili.ads:67:13
Ada.Containers.Doubly_Linked_Lists.First defined at a-cdlili.ads:155:13
Ada.Containers.Doubly_Linked_Lists.Has_Element defined at a-cdlili.ads:185:13
Ada.Containers.Doubly_Linked_Lists.Next defined at a-cdlili.ads:165:14
Delete defined at mutable_lists.ads:124:15
Locking_Objects.Locking_Object.Lock defined at locking_objects.ads:15:15
Locking_Objects.Locking_Object.Unlock defined at locking_objects.ads:20:19
Clears the list, blocking on elements that are being examined.

Find

procedure Find
( this: access List;
element: Element_Type;
position: out Cursor );

References:

mutable_lists.ads:73:15 (declaration)
events-corrals.adb:376:24 (reference)
events-manager.adb:157:22 (reference)
mutable_lists.adb:73:15 (body)
mutable_lists.adb:92:9 (label)

Called by:

Events.Corrals.Remove defined at events-corrals.ads:174:15
Events.Manager.Unregister defined at events-manager.adb:154:15

Calls:

= defined at mutable_lists.ads:8:18
Ada.Containers.Doubly_Linked_Lists.Element defined at a-cdlili.ads:67:13
Ada.Containers.Doubly_Linked_Lists.First defined at a-cdlili.ads:155:13
Ada.Containers.Doubly_Linked_Lists.Has_Element defined at a-cdlili.ads:185:13
Ada.Containers.Doubly_Linked_Lists.Next defined at a-cdlili.ads:165:14
Locking_Objects.Locking_Object.Lock defined at locking_objects.ads:15:15
Locking_Objects.Locking_Object.Unlock defined at locking_objects.ads:20:19
Returns a cursor pointing to the element in the list if it is found. The procedure will block if the element is being examined. If the element is not found in the list, a null cursor will be returned.

First

procedure First
( this: access List;
position: out Cursor );

References:

mutable_lists.ads:77:15 (declaration)
mutable_lists.adb:115:15 (body)
mutable_lists.adb:128:9 (label)
mutable_lists.adb:149:14 (reference)
mutable_lists.adb:170:14 (reference)

Calls:

Ada.Containers.Doubly_Linked_Lists.Element defined at a-cdlili.ads:67:13
Ada.Containers.Doubly_Linked_Lists.First defined at a-cdlili.ads:155:13
Ada.Containers.Doubly_Linked_Lists.Has_Element defined at a-cdlili.ads:185:13
Locking_Objects.Locking_Object.Lock defined at locking_objects.ads:15:15
Locking_Objects.Locking_Object.Unlock defined at locking_objects.ads:20:19
Returns a cursor pointing to the first element in the list, blocking if the first element is being examined.

Is_Empty

function Is_Empty
( this: access List )
return Boolean;

References:

mutable_lists.ads:80:14 (declaration)
events-corrals.adb:355:31 (reference)
events-corrals.adb:379:31 (reference)
mutable_lists.adb:133:14 (body)
mutable_lists.adb:140:9 (label)

Called by:

Events.Corrals.Clear defined at events-corrals.ads:164:15
Events.Corrals.Remove defined at events-corrals.ads:174:15

Calls:

Ada.Containers.Doubly_Linked_Lists.Is_Empty defined at a-cdlili.ads:63:13
Locking_Objects.Locking_Object.Lock defined at locking_objects.ads:15:15
Locking_Objects.Locking_Object.Unlock defined at locking_objects.ads:20:19
Returns True if the list has no elements.

Iterate

procedure Iterate
( this: access List;
examine: access procedure( element : Element_Type )
);

References:

mutable_lists.ads:85:15 (declaration)
events-manager.adb:115:26 (reference)
mutable_lists.adb:145:15 (body)
mutable_lists.adb:159:9 (label)

Called by:

Events.Manager.Queue_Event defined at events-manager.adb:97:15
Iterates forward through the list, blocking on elements that are already being examined. Any thread can still modify the list while one thread is iterating over it, except for elements that are being examined.

Iterate_With_Quit

procedure Iterate_With_Quit
( this: access List;
examine: access procedure( element : Element_Type;
quit: in out Boolean )
);

References:

mutable_lists.ads:91:15 (declaration)
events-corrals.adb:346:24 (reference)
events-manager.adb:149:22 (reference)
mutable_lists.adb:164:15 (body)
mutable_lists.adb:181:9 (label)

Called by:

Events.Corrals.Call defined at events-corrals.ads:158:15
Events.Manager.Trigger_Event defined at events-manager.adb:136:15
Iterates forward through the list with the option of an early exit. Set quit to True in the examine procedure to abort iteration. See Iterate for further details.

Length

function Length
( this: access List )
return Natural;

References:

mutable_lists.ads:96:14 (declaration)
events-corrals.adb:309:31 (reference)
events-manager.adb:113:43 (reference)
mutable_lists.adb:186:14 (body)
mutable_lists.adb:193:9 (label)

Called by:

Events.Corrals.Add defined at events-corrals.ads:151:15
Events.Manager.Queue_Event defined at events-manager.adb:97:15

Calls:

Ada.Containers.Doubly_Linked_Lists.Length defined at a-cdlili.ads:61:13
Locking_Objects.Locking_Object.Lock defined at locking_objects.ads:15:15
Locking_Objects.Locking_Object.Unlock defined at locking_objects.ads:20:19
Returns the number of elements in the list.

Prepend

procedure Prepend
( this: access List;
element: Element_Type );

References:

mutable_lists.ads:99:15 (declaration)
mutable_lists.adb:198:15 (body)
mutable_lists.adb:210:9 (label)

Calls:

Ada.Containers.Doubly_Linked_Lists.Prepend defined at a-cdlili.ads:106:14
Delete defined at mutable_lists.ads:124:15
Locking_Objects.Locking_Object.Lock defined at locking_objects.ads:15:15
Locking_Objects.Locking_Object.Unlock defined at locking_objects.ads:20:19
Prepends an element to the list.

Remove

procedure Remove
( this: access List;
position: in out Cursor );

References:

mutable_lists.ads:103:15 (declaration)
events-corrals.adb:378:28 (reference)
events-manager.adb:159:26 (reference)
mutable_lists.adb:215:15 (body)
mutable_lists.adb:239:9 (label)

Called by:

Events.Corrals.Remove defined at events-corrals.ads:174:15
Events.Manager.Unregister defined at events-manager.adb:154:15

Calls:

Ada.Containers.Doubly_Linked_Lists.Delete defined at a-cdlili.ads:116:14
Ada.Containers.Doubly_Linked_Lists.Has_Element defined at a-cdlili.ads:185:13
Delete defined at mutable_lists.ads:124:15
Has_Element defined at mutable_lists.ads:28:14
Locking_Objects.Locking_Object.Lock defined at locking_objects.ads:15:15
Locking_Objects.Locking_Object.Unlock defined at locking_objects.ads:20:19
Removes the element pointed to by position, blocking if the element is being examined. The cursor will be closed.

Delete

procedure Delete
( this: in out A_List );

References:

mutable_lists.ads:107:15 (declaration)
mutable_lists.adb:243:15 (body)
mutable_lists.adb:272:9 (label)

Calls:

Ada.Containers.Doubly_Linked_Lists.Clear defined at a-cdlili.ads:65:14
Ada.Containers.Doubly_Linked_Lists.Element defined at a-cdlili.ads:67:13
Ada.Containers.Doubly_Linked_Lists.First defined at a-cdlili.ads:155:13
Ada.Containers.Doubly_Linked_Lists.Has_Element defined at a-cdlili.ads:185:13
Ada.Containers.Doubly_Linked_Lists.Next defined at a-cdlili.ads:165:14
Delete defined at mutable_lists.ads:124:15
Locking_Objects.Locking_Object.Lock defined at locking_objects.ads:15:15
Locking_Objects.Locking_Object.Unlock defined at locking_objects.ads:20:19
Mutable_Lists.Delete.Free defined at mutable_lists.adb:245:19
Unchecked_Deallocation defined at a-uncdea.ads:20:15
Deletes the list. If there are any open cursors, the deletion will fail without modifying the list and an exception will be raised.