GNU
|
Liberty Eiffel
|
Automated Tests
|
Wiki
|
Savannah project
|
Debian packages
|
Documentation
>
libraries
>
REPOSITORY_LAYOUT
+
Point of view
All features
ANY
RECYCLING_POOL
REPOSITORY_IMPL
REPOSITORY_LAYOUT
All features
class REPOSITORY_LAYOUT
Summary
top
Used by the update engine of
REPOSITORY_IMPL
to ensure correct object references and cycles handling.
Direct parents
Insert list:
INTERNALS_HANDLER
,
RECYCLABLE
Class invariant
top
has_kind:
kind
/= Void
solved_internals_coherence:
not
solved
and
internals_memory
/= Void implies
internals_memory
.object_can_be_modified
reference_has_ref: kind.is_equal(
"reference"
) implies (ref > 0 or trans_ref /= Void)
reference_is_solved:
kind
.is_equal("reference") and
internals_set
implies
solved
reference_dont_have_layouts:
kind
.is_equal("reference") implies
layouts
.is_empty
transient_or_ref:
trans_ref
/= Void implies
ref
= 0
assigned_are_layouts:
assigned
.for_all(
layouts
.has())
coherence:
solved
implies
internals_set
Overview
top
Creation features
{
REPOSITORY_IMPL
}
make
Features
{
REPOSITORY_IMPL
,
REPOSITORY_LAYOUT
}
type
:
STRING
data type, if useful
capacity
:
INTEGER_32
for native arrays only
ref
:
INTEGER_32
object reference, for reference objects only
trans_ref
:
STRING
object transient reference, for reference objects only
name
:
STRING
object name
value
:
STRING
object value, for basic types only
layouts
:
AVL_DICTIONARY
[REPOSITORY_LAYOUT,
STRING
]
child layouts
assigned
:
HASHED_SET
[
STRING
]
each layout for which the
INTERNALS
object was assigned
solved
:
BOOLEAN
solve
(a_solver:
FUNCTION
[
TUPLE 1
[
INTEGER_32
],
INTERNALS
]):
INTERNALS
{
REPOSITORY_LAYOUT
}
internals_set
:
BOOLEAN
True when
internals_memory
was set
{}
internals_memory
:
INTERNALS
internals
(a_solver:
FUNCTION
[
TUPLE 1
[
INTEGER_32
],
INTERNALS
]):
INTERNALS
{
REPOSITORY_IMPL
}
kind
:
STRING
The layout kind.
is_clear
:
BOOLEAN
set_kind
(a_kind:
STRING
)
set_type
(a_type:
STRING
)
set_capacity
(a_capacity:
INTEGER_32
)
set_ref
(a_ref:
INTEGER_32
)
set_trans_ref
(a_trans_ref:
STRING
)
set_name
(a_name:
STRING
)
set_value
(a_value:
STRING
)
add_layout
(a_layout: REPOSITORY_LAYOUT)
{
RECYCLING_POOL
}
recycle
Do whatever needs to be done to free resources or recycle other objects when recycling this one
{}
make
type_memory
:
STRING
trans_ref_memory
:
STRING
name_memory
:
STRING
value_memory
:
STRING
{}
valid_generating_type_for_internals
(type:
STRING
):
BOOLEAN
internals_from_generating_type
(type:
STRING
):
INTERNALS
valid_generating_type_for_native_array_internals
(type:
STRING
):
BOOLEAN
native_array_internals_from_generating_type
(type:
STRING
, capacity:
INTEGER_32
):
INTERNALS
type
:
STRING
writable attribute
{
REPOSITORY_IMPL
,
REPOSITORY_LAYOUT
}
top
data type, if useful
capacity
:
INTEGER_32
writable attribute
{
REPOSITORY_IMPL
,
REPOSITORY_LAYOUT
}
top
for native arrays only
ref
:
INTEGER_32
writable attribute
{
REPOSITORY_IMPL
,
REPOSITORY_LAYOUT
}
top
object reference, for reference objects only
trans_ref
:
STRING
writable attribute
{
REPOSITORY_IMPL
,
REPOSITORY_LAYOUT
}
top
object transient reference, for reference objects only
name
:
STRING
writable attribute
{
REPOSITORY_IMPL
,
REPOSITORY_LAYOUT
}
top
object name
value
:
STRING
writable attribute
{
REPOSITORY_IMPL
,
REPOSITORY_LAYOUT
}
top
object value, for basic types only
layouts
:
AVL_DICTIONARY
[REPOSITORY_LAYOUT,
STRING
]
writable attribute
{
REPOSITORY_IMPL
,
REPOSITORY_LAYOUT
}
top
child layouts
assigned
:
HASHED_SET
[
STRING
]
writable attribute
{
REPOSITORY_IMPL
,
REPOSITORY_LAYOUT
}
top
each layout for which the
INTERNALS
object was assigned
solved
:
BOOLEAN
writable attribute
{
REPOSITORY_IMPL
,
REPOSITORY_LAYOUT
}
top
solve
(a_solver:
FUNCTION
[
TUPLE 1
[
INTEGER_32
],
INTERNALS
]):
INTERNALS
effective function
{
REPOSITORY_IMPL
,
REPOSITORY_LAYOUT
}
top
ensure
Result /= Void and then Result.object_can_be_retrieved implies
solved
internals_set
:
BOOLEAN
writable attribute
{
REPOSITORY_LAYOUT
}
top
True when
internals_memory
was set
internals_memory
:
INTERNALS
writable attribute
{}
top
internals
(a_solver:
FUNCTION
[
TUPLE 1
[
INTEGER_32
],
INTERNALS
]):
INTERNALS
effective function
{}
top
require
not
solved
kind
:
STRING
writable attribute
{
REPOSITORY_IMPL
}
top
The layout kind.
Almost everything is common between layout kinds. If things begin to diverge too much, change that to a real polymorphism.
is_clear
:
BOOLEAN
effective function
{
REPOSITORY_IMPL
}
top
set_kind
(a_kind:
STRING
)
effective procedure
{
REPOSITORY_IMPL
}
top
require
is_clear
FAST_ARRAY[
STRING
]"repository""reference""layout""embedded""basic""array".has(a_kind)
ensure
not
is_clear
kind
.is_equal(a_kind)
set_type
(a_type:
STRING
)
effective procedure
{
REPOSITORY_IMPL
}
top
require
not
is_clear
type
= Void
a_type /= Void
ensure
type
.is_equal(a_type)
set_capacity
(a_capacity:
INTEGER_32
)
effective procedure
{
REPOSITORY_IMPL
}
top
ensure
capacity
= a_capacity
set_ref
(a_ref:
INTEGER_32
)
effective procedure
{
REPOSITORY_IMPL
}
top
require
not
is_clear
ref
= 0
a_ref > 0
trans_ref
= Void
ensure
ref
= a_ref
set_trans_ref
(a_trans_ref:
STRING
)
effective procedure
{
REPOSITORY_IMPL
}
top
require
not
is_clear
trans_ref
= Void
a_trans_ref /= Void
ref
= 0
ensure
trans_ref
.is_equal(a_trans_ref)
set_name
(a_name:
STRING
)
effective procedure
{
REPOSITORY_IMPL
}
top
require
not
is_clear
name
= Void
a_name /= Void
ensure
name
.is_equal(a_name)
set_value
(a_value:
STRING
)
effective procedure
{
REPOSITORY_IMPL
}
top
require
not
is_clear
value
= Void
a_value /= Void
ensure
value
.is_equal(a_value)
add_layout
(a_layout: REPOSITORY_LAYOUT)
effective procedure
{
REPOSITORY_IMPL
}
top
require
not
is_clear
a_layout.
name
/= Void
not
kind
.is_equal("reference")
ensure
layouts
.at(a_layout.
name
) = a_layout
recycle
effective procedure
{
RECYCLING_POOL
}
top
Do whatever needs to be done to free resources or recycle other objects when recycling this one
ensure
is_clear
make
effective procedure
{}
top
ensure
is_clear
type_memory
:
STRING
writable attribute
{}
top
trans_ref_memory
:
STRING
writable attribute
{}
top
name_memory
:
STRING
writable attribute
{}
top
value_memory
:
STRING
writable attribute
{}
top
valid_generating_type_for_internals
(type:
STRING
):
BOOLEAN
frozen
{}
top
require
type /= Void
ensure
Result implies not type.has_prefix("NATIVE_ARRAY")
internals_from_generating_type
(type:
STRING
):
INTERNALS
frozen
{}
top
require
valid_generating_type_for_internals
(type)
ensure
Result /= Void
Result.object_can_be_modified
valid_generating_type_for_native_array_internals
(type:
STRING
):
BOOLEAN
frozen
{}
top
require
type /= Void
ensure
Result implies type.has_prefix("NATIVE_ARRAY")
native_array_internals_from_generating_type
(type:
STRING
, capacity:
INTEGER_32
):
INTERNALS
frozen
{}
top
require
valid_generating_type_for_native_array_internals
(type)
ensure
Result /= Void
Result.object_can_be_modified