Copyright ã1995 by NeXT Computer, Inc.  All Rights Reserved.

IOAddressRanger

Inherits From:	Object

Declared In:	driverkit/IOAddressRanger.h

Class Description

The IOAddressRanger class provides user interface and type checking to be used in device inspecting modules for the Configure application. IOAddressRangers are used in IODeviceInspector for choosing values for I/O port ranges and ranges of memory. 

An IOAddressRanger limits the range to a constant length that you specify with setRangeLength:. The range is also limited to be between the addresses you specify with setAddressLimits::. Whenever an address limit or range length is changed or the selected address range is changed, the IOAddressRanger adjusts the address range as follows:

·	If the start address is less than the lower address limit, the start address is changed to be equal to the lower limit.

·	If the range contains addresses above the higher limit, the start address is adjusted downward so that the range's last address is equal to the higher limit.

Instance Variables

None declared in this class.

Method Types

Checking address ranges	- checkRangesForConflicts:num:
- checkText:

Setting and getting the start address
- setStartAddress:
- startAddress

Action methods	- minus:
- plus:

Setting and getting the range length 
- rangeLength
- setRangeLength:

Limiting the address range	- setAddressLimits::

Assigning a delegate	- setDelegate:
- delegate

Delegate methods	- rangeDidChange:

Instance Methods

checkRangesForConflicts:num:

- (BOOL)checkRangesForConflicts:(IOAddressRanger *)ranges num:(unsigned int)numRanges 

A configuration inspector invokes this method to check whether this IOAddressRanger uses any addresses already used by the specified IOAddressRangers. If so, this method changes the color of the text in the text field to gray and sets the status button on. If no conflicts exist, this method sets the status button off and changes the color of the text to black. Returns NO if no conflicts exist and YES if conflicts exist.

checkText:

- checkText:sender 

Checks whether sender's string value is an address and, if so, sets the range's start address (adjusted as described in the class description), updates the display, and sends the delegate a rangeDidChange: message. If the string isn't an address, the system beeps and updates the range's display. Returns self if the string is an address; otherwise, returns nil.

delegate

- delegate

Returns the IOAddressRanger's delegate, or nil if it doesn't have one.

minus:

- minus:sender 

This method is the target of the minus button in the IOAddressRanger. It moves the range down by the amount of the range's length (but no lower than the lower limit), updates the display, and sends the delegate a rangeDidChange: message. As an example, if the range is currently from 0x000e00 to 0x000eff, this method changes the range to be from 0x000d00 to 0x000dff. Returns self.

plus:

- plus:sender 

This method is the target of the plus button in the IOAddressRanger. It moves the range higher by the amount of the range's length (but not above the higher limit), updates the display, and sends the delegate a rangeDidChange: message. As an example, if the range is currently from 0x000e00 to 0x000eff, this method changes the range to be from 0x000f00 to 0x000fff. Returns self.

rangeLength

- (unsigned long)rangeLength

Returns the length of the range. This length should be set at initialization using setRangeLength:.

setAddressLimits::

- setAddressLimits:(unsigned long)low :(unsigned long)high 

Limits the address range to values between low (inclusive) and high (inclusive) and adjusts the start address, as described in the class description. Returns self.

setDelegate:

- setDelegate:anObject 

Makes anObject the IOAddressRanger's delegate, and returns self. The delegate is sent a rangeDidChange: message whenever the address range changes. 

setRangeLength:

- setRangeLength:(unsigned long)length 

Sets the length of the range and returns self. The new length is displayed and the start address is adjusted as described in the class description.

setStartAddress:

- setStartAddress:(unsigned long)address 

Sets the start address of the range (adjusted as described in the class description) and returns self.

startAddress

- (unsigned long)startAddress

Returns the start of the range. This length should be set at initialization using setStartAddress:.

Delegate Methods

rangeDidChange:

- rangeDidChange:sender

Informs the delegate that the range changed.