INDEX CLUSTER FEATURES SHORT FRAMES NO FRAMES

indexing

title: "Long and binary data support"
project: "Visual Eiffel"
revision: "$Revision: 1.1 $"
copyright: "Copyright (C) 1996-2005 Object Tools Group"
license: "http://visual-eiffel.com/license"
cluster: dale
class BLOB
inherit

DALE_SERVER
redefine
out
end

MEMORY
export
{NONE}
all
redefine
dispose,
out
end
creation

make,
make_external,
make_external_t,
make_t
feature -- Constants:

max_portion_size: INTEGER

max_data_size: INTEGER
feature -- Attributes:

max_storage_size: INTEGER

is_allocated: BOOLEAN

to_external: POINTER

end_of_data: BOOLEAN

type: INTEGER
feature -- Commands:

make (nbytes: INTEGER)
-- creation procedure; creates a buffer of the specified size
require
valid_size: valid_size (nbytes)

make_external (ext_buf: POINTER; nbytes: INTEGER)
-- creation procedure
require
valid_size: valid_size (nbytes)

make_t (nbytes: INTEGER; t: INTEGER)
-- creation procedure; creates a buffer of the specified size and
-- set blob type
require
valid_size: valid_size (nbytes)
valid_type: tconst.is_blob_type (t)

make_external_t (ext_buf: POINTER; nbytes: INTEGER; t: INTEGER)
-- creation procedure
require
valid_size: valid_size (nbytes)
valid_type: tconst.is_blob_type (t)

merge (other: like Current)
-- merge the contents of another BLOB; the current BLOB
-- will be resized if it's be needed
require
not_void: other /= void
allocated: is_allocated
ensure
well_done: size = size + other.size

move (other: like Current; offs, other_offs, nbytes: INTEGER)
-- copy 'nbytes' from other BLOB starting from 'other_offs'
-- to the current BLOB starting from the 'offs'
-- the current BLOB will be resized if it's be needed
require
valid_argument: other /= void and then nbytes <= other.size - other_offs
valid_parameters: offs >= 0 and other_offs >= 0 and nbytes > 0 and then nbytes <= other.size - other_offs
ensure
well_done: (size = size ) or (size = offs + nbytes)

resize (new_size: INTEGER)
-- resize buffer for data; allocates memory if wasn't before
require
valid_size: valid_size (new_size)
allocated: is_allocated
ensure
well_done: size = new_size

close
-- deallocate memory
ensure
deallocated: not is_allocated
feature -- Removal

dispose
-- redefined from MEMORY
feature -- Queries:

size, count: INTEGER
-- count of bytes in this BLOB
ensure
valid_result: valid_size (Result)

portion_size: INTEGER
-- ...

to_string: STRING
-- create string by the contents of this BLOB
require
valid_pointer: valid_pointer (to_external)

out: STRING
-- printable representation

more (b: BOOLEAN)
-- ...
feature -- Settings:

set_max_storage_size (i: INTEGER)
-- Set `max_storage_size'.

set_end_of_data (b: BOOLEAN)
-- ...

set_type (t: INTEGER)
-- ...
require
valid_type: tconst.is_blob_type (t)
feature -- Validation:

valid_pointer (ptr: POINTER): BOOLEAN
-- is this pointer valid?

valid_size (n: INTEGER): BOOLEAN
-- is this size valid?
invariant

valid_storage: is_allocated implies valid_pointer (to_external)
end -- class BLOB

INDEX CLUSTER FEATURES SHORT FRAMES NO FRAMES