deferred class REPOSITORY [O_ -> STORABLE]

Features exported to ANY

A REPOSITORY for objects of type O_ can be viewed as a DICTIONARY[O_, STRING] (i.e. objects of type O_ are stored using key names which are actually ordinary STRINGs). Also note that stored objects of type O_ are always non-Void objects.

A repository is meant to be stored on a physical store (say, a stream, a file, a database and so on).

The only one subclass of REPOSITORY is at time beeing the class XML_REPOSITORY.

Direct parents

non-conformant parents

INTERNALS_HANDLER

Known children

conformant children

XML_REPOSITORY

Summary

exported features

Getting and setting objects in the repository:

Counting:

Iterating facilities:

Really storing data:

Details

frozen has (object_name: STRING): BOOLEAN

Is object_name the name of some stored object.

require

  • not object_name.is_empty

frozen at (object_name: STRING): O_

Return the object currently associated to object_name.

require

  • has(object_name)

ensure

  • Result /= Void

frozen add (object: O_, object_name: STRING)

Update or add a new object in the Current repository.

require

  • object /= Void
  • new_reference: not has(object_name)

ensure

  • reference_stored: object = at(object_name)

frozen put (object: O_, object_name: STRING)

Update or add a new object in the Current repository.

require

  • object /= Void

ensure

  • reference_stored: object = at(object_name)

remove (object_name: STRING)

Remove entry object_name from the Current repository.

require

  • has(object_name)

ensure

  • not has(object_name)

count: INTEGER

Actual count of stored elements.

is_empty: BOOLEAN

Is it empty ?

ensure

  • Result = (count = 0)

lower: INTEGER
upper: INTEGER

ensure

  • Result = count

valid_index (index: INTEGER): BOOLEAN

ensure

  • Result = index.in_range(lower, upper)

item (index: INTEGER): O_

require

  • valid_index(index)

ensure

  • Result = at(key(index))

key (index: INTEGER): STRING

require

  • valid_index(index)

ensure

  • at(Result) = item(index)

get_new_iterator_on_items: ITERATOR[O_]

ensure

  • Result /= Void

get_new_iterator_on_keys: ITERATOR [E_][STRING]

ensure

  • Result /= Void

key_map_in (buffer: COLLECTION [E_][STRING])

Append in buffer, all available keys (this may be useful to speed up the traversal).

require

  • buffer /= Void

ensure

  • buffer.count = count + old buffer.count

item_map_in (buffer: COLLECTION[O_])

Append in buffer, all available items (this may be useful to speed up the traversal).

require

  • buffer /= Void

ensure

  • buffer.count = count + old buffer.count

deferred update

Update the repository objects. Get all objects from the physical store.

require

  • is_updateable

deferred commit

Commit all the repository objects to the physical store.

require

  • is_commitable

deferred is_connected: BOOLEAN

True if the repository is connected to a physical store.

deferred is_updateable: BOOLEAN

True if the repository can be updated from data in the physical store.

deferred is_commitable: BOOLEAN

True if the repository can be committed to the underlying physical store.

Class invariant