Package: Controlled_Map (generic)

## Documentation

Table of Contents
Class Inheritance Tree

## Index

Package: Controlled_Map (generic)

- Goto spec source

# Description

    generic
       type Key_Type (<>) is private;
       type Element_Type (<>) is limited private;
       type Element_Handle is access Element_Type;

       with function "<" (Left, Right : Key_Type) return Boolean is <>;

    --  Controlled variant of a map. The memory of an element pointed to by a
    --  previously inserted handle is freed upon calling Delete, Clear or during
    --  finalization of the controlled map. Thus control over objects inserted into
    --  this map resides with the controlled map.
    package Alog.Controlled_Map is

Copyright (c) 2009, Reto Buerki, Adrian-Ken Rueegsegger This file is part of Alog. Alog is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. Alog is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with Alog; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

# Classes

### Map

- Goto declaration in source
- Goto full declaration in source

    type Map is new Ada.Finalization.Limited_Controlled with private;

#### Ancestors:

Limited_Controlled

#### Primitive operations:

Adjust
Clear

- To API doc
- To spec

Contains

- To API doc
- To spec

Delete

- To API doc
- To spec

Element

- To API doc
- To spec

Finalize
Initialize
Insert

- To API doc
- To spec

Is_Empty

- To API doc
- To spec

Iterate

- To API doc
- To spec

Length

- To API doc
- To spec

A controlled map container.

# Types

### Key_Type

- Goto declaration in source

    type Key_Type (<>) is private;

### Element_Type

- Goto declaration in source

    type Element_Type (<>) is limited private;

### Element_Handle

- Goto declaration in source

    type Element_Handle is access Element_Type;

# Subprograms & Entries

### <

- Goto spec in source

    function "<" (Left, Right: Key_Type) return Boolean is <>;

### Insert

- Goto spec in source

    procedure Insert (Container: in out Map;Key:        Key_Type;New_Item:        Element_Handle);

Insert a new element handle with 'Key' into the controlled map.

### Element

- Goto spec in source

    function Element (Container: Map;Key: Key_Type) return Element_Handle;

Return a handle to an element identified by 'Key'.

### Delete

- Goto spec in source

    procedure Delete (Container: in out Map;Key:        Key_Type);

Delete the element with key 'Key' from the map. Memory of the element is freed.

### Contains

- Goto spec in source

    function Contains (Container: Map;Key: Key_Type) return Boolean;

Returns True if an element with key 'Key' is in the map.

### Is_Empty

- Goto spec in source

    function Is_Empty (Container: Map) return Boolean;

Returns True if the map is empty.

### Clear

- Goto spec in source

    procedure Clear (Container: in out Map);

Remove all elements in the map. Memory of the elements is freed.

### Length

- Goto spec in source

    function Length (Container: Map) return Natural;

Return the current element count.

### Iterate

- Goto spec in source

    procedure Iterate (Container: Map;Process: not null access procedure (Handle : Element_Handle));

Iterate over all elements in the map and call the 'Process' procedure for each handle.