vvopensource
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Groups Pages
Instance Methods
MutNRLockDict Class Reference

Subclass of MutLockDict; this class does NOT retain the objects in its array! More...

#import <MutNRLockDict.h>

Inherits MutLockDict.

Instance Methods

(void) - setObject:forKey:
 functions similar to the NSDictionary method, but checks to make sure you aren't trying to insert a nil value or use a nil key. not threadsafe!
 
(void) - setValue:forKey:
 functions similar to the NSDictionary method- not threadsafe
 
(id) - objectForKey:
 returns the object stored in the underlying dict at the passed key- not threadsafe
 
(NSArray *) - allValues
 returns an array with all the values from the underlying dictionary- not threadsafe.
 
- Instance Methods inherited from MutLockDict
(id) - initWithCapacity:
 functions similarly to the NSDictionary method- inits a MutLockDict with the supplied capacity
 
(void) - rdlock
 blocks until it can establish a read-lock on the array, and then returns. try to avoid calling this- using the built-in methods (which unlock before they return) is generally preferable/safer!
 
(void) - wrlock
 blocks until it can establish a write-lock on the array, and then returns. try to avoid calling this- using the built-in methods (which unlock before they return) is generally preferable/safer!
 
(void) - unlock
 unlocks and returns immediately
 
(NSMutableDictionary *) - dict
 returns the NSMutableDictionary used as the basis for this class- useful if you want to use fast iteration/that sort of thing
 
(NSMutableDictionary *) - createDictCopy
 creates a mutable, autoreleased copy of the dict and returns it. be careful, this method isn't threadsafe!
 
(NSMutableDictionary *) - lockCreateDictCopy
 creates a mutable, autoreleased copy of the dict and returns it. this method is threadsafe.
 
(void) - lockSetObject:forKey:
 establishes a write-lock, then calls setObject:forKey:. threadsafe.
 
(void) - lockSetValue:forKey:
 establishes a write-lock, then calls setValue:forKey:. threadsafe.
 
(void) - removeAllObjects
 removes all objects from the underlying dict- not threadsafe
 
(void) - lockRemoveAllObjects
 establishes a write-lock, then removes all objects from the underlying dict. threadsafe.
 
(id) - lockObjectForKey:
 establihes a read-lock, then returns the object stored in the underlying dict at the passed key. threadsafe.
 
(void) - removeObjectForKey:
 attempts to remove any object stored in the underlying dict at the passed key- not threadsafe.
 
(void) - lockRemoveObjectForKey:
 establishes a write-lock, then removes any object stored in the underlying dict at the passed key. threadsafe.
 
(void) - addEntriesFromDictionary:
 adds all entries from the passed dict to the receiver's underlying dictionary- not threadsafe.
 
(void) - lockAddEntriesFromDictionary:
 establishes a write-lock, then calls "addEntriesFromDictionary:". threadsafe.
 
(NSArray *) - allKeys
 returns an array with all the keys from the underlying dictionary- not threadsafe
 
(NSArray *) - lockAllKeys
 establishes a read-lock, then calls "allKeys". threadsafe.
 
(NSArray *) - lockAllValues
 establishes a read-lock, then calls "allValues". threadsafe.
 
(void) - makeObjectsPerformSelector:
 calls "makeObjectsPerformSelector" on the array of values returned by the underlying dictionary- not threadsafe.
 
(void) - lockMakeObjectsPerformSelector:
 establishes a read-lock, then calls "makeObjectsPerformSelector:". threadsafe.
 
(NSInteger) - count
 returns the number of objects in the underlying dictionary- not threadsafe.
 
(NSInteger) - lockCount
 establishes a read-lock, then returns the number of objects in the underlying dictionary. threadsafe.
 

Additional Inherited Members

- Class Methods inherited from MutLockDict
(id) + dictionaryWithCapacity:
 functions similarly to the NSDictionary method
 
(id) + dictionaryWithDict:
 functions similarly to the NSDictionary method- creates and returns an auto-released instance of MutLockDict populated with the contents of the passed dictionary
 

Detailed Description

Subclass of MutLockDict; this class does NOT retain the objects in its array!

this class exists because i frequently find myself in situations where i want to add an instance of an object to an array/dict/[any class which retains the passed instance], but i don't actually want the item to be retained.

Instead of adding (and therefore retaining) objects to an array like my superclass, this class makes an ObjectHolder for objects which are added to it (so they don't get retained), and adds the ObjectHolder to me. when other classes ask me for the index of an object, or ask for the object at a particular index, i'll find the relevant ObjectHolder and then return the object it's storing.


The documentation for this class was generated from the following files: