Re: Implementing Manual KVO For Bitfields Set in Atomic Operations

2012-08-22 Thread Scott A Andrew
Why not have an update flags function and a set of booleans that represent the flags. @interface someInterface { BOOL _isFoo; BOOL _isBar; } @property (nonatomic, readonly, assign) BOOL isFoo; @property (nonatomic, readonly, assign) BOOL isBar; -(void) updateFlags:(int)bits; @en

Re: Implementing Manual KVO For Bitfields Set in Atomic Operations

2012-08-22 Thread Andreas Grosam
On 21.08.2012, at 22:35, Quincey Morris wrote: > This doesn't make sense as it stands. You've declared properties that need > setters as well as getters, and the setters (which you didn't show code for) > will give you KVO compliance without any explicit will/didChanging. Well, the description

Re: Implementing Manual KVO For Bitfields Set in Atomic Operations

2012-08-21 Thread Scott A Andrew
Check out http://newwavedigitalmedia.com/blog/?p=132 I'll fix the image issues shortly. But basically it shows how to setup KVO for calculated values. So you could create KVO for each state using keyPathsForValuesAffecting then implement getters and setters. So each state could be handled via

Re: Implementing Manual KVO For Bitfields Set in Atomic Operations

2012-08-21 Thread Seth Willits
On Aug 21, 2012, at 3:53 AM, Andreas Grosam wrote: > So, in order to implement KVO, I would need to track changes of the ivar > _state, and invoke > -willChangeValueForKey:, and > -didChangeValueForKey: > appropriately. > > But, how exactly can I accomplish this with the given code above? Yo

Implementing Manual KVO For Bitfields Set in Atomic Operations

2012-08-21 Thread Andreas Grosam
I'm struggling implementing proper KVO for a number of Bool properties whose state is retrieved from a bit field or a bit mask. These bits are part of a single "_state" integer ivar, which will be modified with atomic operations: enum StateT { StateZero = 0, State_X = 1 << 0, State_