Eiffel Media API
Overview Cluster Class Classes Index      Previous Next      Top Features

em.cdrom

Class EM_CDROM_TRACK


Direct ancestors

EM_CONSTANTS, SDL_CDTRACK_STRUCT_EXTERNAL, EWG_STRUCT

Creation

Features

Invariants

indexing

description

Class for wrapping C SDL_CDtrack struct.

date

$Date: 2005/10/23 09:02:15 $

revision

$Revision: 1.5 $

class

EM_CDROM_TRACK

inherit

EWG_STRUCT

create

make_new_shared

-- Create a new pointer wrapper to a new struct.
-- Allocates as much new memory as the struct needs.
-- 'shared' means if the Current object
-- gets collected by the garbage collector,
-- the memory allocated for the struct will
-- not be freed as well.

-- (From EWG_STRUCT)

ensure
exists: exists
is_shared: is_shared
make_shared (a_item: POINTER)

-- Create a new pointer wrapper to a given struct.
-- 'shared' means if the Current object
-- gets collected by the garbage collector,
-- the memory allocated for the struct will
-- not be freed as well.

-- (From EWG_STRUCT)

require
a_item_not_default_pointer: a_item /= Default_pointer
ensure
exists: exists
item_set: item = a_item
is_shared: is_shared

feature {ANY} -- Access

exists: BOOLEAN

-- Does item point to a valid C struct ?

-- (From EWG_STRUCT)

is_shared: BOOLEAN

-- Is the contents of item referenced by other C or Eiffel code?
-- If is_shared is True then when the current object will be
-- collected by the garbage collector, the wrapped struct will
-- also be freed.
-- This is a good idea, only if you can be sure that when the
-- Eiffel object gets collected, the C side does not have a reference
-- to the wrapped struct anymore.

-- (From EWG_STRUCT)

require
exists: exists
item: POINTER

-- Pointer to the wrapped struct

-- (From EWG_STRUCT)

require
exists: exists
ensure
item_not_default_pointer: Result /= Default_pointer

feature {ANY} -- Member Access

is_audio_track: BOOLEAN

-- is this track an audio track?

require
exists: exists
ensure
result_correct: result implies get_type_external (item) = em_cdrom_audio_track
is_data_track: BOOLEAN

-- is this track a data track?

require
exists: exists
ensure
result_correct: result implies get_type_external (item) = em_cdrom_data_track
length: INTEGER

-- length of this track in seconds

require
exists: exists
ensure
result_correct: result = get_length_external (item) // em_cdrom_fps
length_string: STRING

-- return an human readable length string (hh:mm:ss)

require
exists: exists
offset: INTEGER

-- time in seconds elapsed since track began

require
exists: exists
ensure
result_correct: result = get_offset_external (item) // em_cdrom_fps
offset_string: STRING

-- return an human readable offset string (hh:mm:ss)

require
exists: exists
track_number: INTEGER

-- track number

require
exists: exists
ensure
result_correct: result = get_id_external (item)
type: INTEGER

-- return the type of this track (use is_data_track or is_audio_track)

require
exists: exists
ensure
result_correct: result = get_type_external (item)

feature -- Implementation

sizeof: INTEGER

-- (From EWG_STRUCT)

ensure
sizeof_positive: Result > 0

invariant


-- From ANY
reflexive_equality: standard_is_equal (Current)
reflexive_conformance: conforms_to (Current)

-- From EWG_STRUCT
managed_data_not_void: managed_data /= Void
managed_capacity_equals_sizeof: exists implies managed_data.capacity = sizeof

end