indexing description: "[ Singleton representing the CDRom subsystem. Use EM_SHARED_SUBSYSTEMS to access this class. ]" date: "$Date$" revision: "$Revision$" class EM_CDROM_SUBSYSTEM inherit EM_SUBSYSTEM SDL_CDROM_FUNCTIONS_EXTERNAL export {NONE} all end create {EM_SHARED_BASE_SUBSYSTEMS} make feature {NONE} -- Initialization make is do create devices.make ensure not_enabled: not is_enabled end feature -- Status report is_enabled: BOOLEAN is -- Is the cdrom subsystem enabled? do Result := 0 /= sdl_was_init_external (Em_init_cdrom) end feature -- Subsysten management enable is -- Enable EiffelMedia CDRom Subsystem. local i: INTEGER do i := sdl_init_external (Em_init_cdrom) end disable is -- Disable EiffelMedia CDRom Subsystem. local cur_item: EM_CDROM do -- first close all open device handler from devices.start until devices.after loop cur_item := devices.item devices.forth cur_item.close end sdl_quit_sub_system_external (Em_init_cdrom) ensure then no_active_devices: devices.count = 0 end feature {EM_CDROM} -- device administration devices: LINKED_LIST [EM_CDROM] -- list of all active devices register_device (a_device: EM_CDROM) is -- register a new device handler require not_already_registered: not devices.has (a_device) do devices.extend (a_device) ensure registration_success: devices.has (a_device) end unregister_device (a_device: EM_CDROM) is -- unregister a device handler require device_registered: devices.has (a_device) do devices.start devices.prune (a_device) ensure unregistration_success: not devices.has (a_device) end feature -- cdrom subsystem name (a_device: INTEGER): STRING is -- return the cdrom device identifier of device `a_device' -- this argument is system dependent require subsystem_ebabled: is_enabled local str: EWG_ZERO_TERMINATED_STRING do create str.make_shared (sdl_cdname_external (a_device)) result := str.string end count: INTEGER is -- cdrom device count do result := sdl_cdnum_drives_external ensure count_set: result = sdl_cdnum_drives_external end name_list: DS_LINKED_LIST [STRING] is -- return a list of all device names local i: INTEGER do -- create list create result.make -- fill the list with all cdrom device names from i := 0 until i = count loop result.put_last (name (i)) i := i + 1 end ensure all_devices_in_list: Result.count = count end end