Oolite
Loading...
Searching...
No Matches
OOShipGroup(Private) Category Reference

Instance Methods

(BOOL) - resizeTo:
 
(void) - cleanUp
 
(NSUInteger) - updateCount
 

Detailed Description

Definition at line 65 of file OOShipGroup.m.

Method Documentation

◆ cleanUp

- (void) cleanUp

Extends class OOShipGroup.

Definition at line 54 of file OOShipGroup.m.

383{
384 NSUInteger newCapacity = _capacity;
385
386 if (_count >= kMaxFreeSpace)
387 {
388 if (_capacity > _count + kMaxFreeSpace)
389 {
390 newCapacity = _count + 1; // +1 keeps us at powers of two + multiples of kMaxFreespace.
391 }
392 }
393 else
394 {
395 if (_capacity > _count * 2)
396 {
397 newCapacity = OORoundUpToPowerOf2_NS(_count);
398 if (newCapacity < kMinSize) newCapacity = kMinSize;
399 }
400 }
401
402 if (newCapacity != _capacity) [self resizeTo:newCapacity];
403}
@ kMaxFreeSpace
Definition OOShipGroup.m:44
@ kMinSize
Definition OOShipGroup.m:43

Referenced by OOShipGroup::countByEnumeratingWithState:objects:count:.

+ Here is the caller graph for this function:

◆ resizeTo:

- (BOOL) resizeTo: (NSUInteger)  newCapacity

Extends class OOShipGroup.

Definition at line 54 of file OOShipGroup.m.

367 :(NSUInteger)newCapacity
368{
369 OOWeakReference **temp = NULL;
370
371 if (newCapacity < _count) return NO;
372
373 temp = realloc(_members, newCapacity * sizeof *_members);
374 if (temp == NULL) return NO;
375
376 _members = temp;
377 _capacity = newCapacity;
378 return YES;
379}

◆ updateCount

- (NSUInteger) updateCount

Extends class OOShipGroup.

Definition at line 54 of file OOShipGroup.m.

407{
408 return _updateCount;
409}

The documentation for this category was generated from the following file: