Re: [NSBitmapImageRep getBitmapDataPlanes] copying data?

2011-02-21 Thread Jonny Taylor
>> I am looking at the performance of my code, and have found that rather a lot >> of time is spent in [NSBitmapImageRep getBitmapDataPlanes]. This is rather >> disappointing because I had assumed this was a 'trivial' way of getting a >> pointer to the actual data store itself in the case of ras

Synchronizing to screen refresh rate

2010-12-17 Thread Jonny Taylor
Hi all, I have been reading up on an area unfamiliar to me - fullscreen drawing and display refresh rates. This is for a scientific application - we have a third party external pixellated device which presents itself as a second monitor over DVI, but with an unusually high refresh rate (about 2

Re: Subclasses, protocols and properties - compiler warning

2010-11-22 Thread Jonny Taylor
>> I am encountering what I believe to be a spurious compiler warning. I wonder >> whether this is a clue that I am doing something differently to how I >> "should" do it. The problem comes if I define a protocol containing a >> property and then define that property in a base class that does NO

Subclasses, protocols and properties - compiler warning

2010-11-19 Thread Jonny Taylor
I am encountering what I believe to be a spurious compiler warning. I wonder whether this is a clue that I am doing something differently to how I "should" do it. The problem comes if I define a protocol containing a property and then define that property in a base class that does NOT conform to

Re: Calling getter on const object

2010-11-09 Thread Jonny Taylor
>>> I now think that what I am seeing is a minor parsing sort of issue within >>> the compiler (gcc 4.2) when mixing id with blocks. >> The more fundamental problem is that gcc C++ does not fully support blocks, >> period. > Indeed, as soon as it gets a sniff of c++ near a block things start to

Re: Calling getter on const object

2010-11-08 Thread Jonny Taylor
On 8 Nov 2010, at 20:11, Greg Parker wrote: >> I now think that what I am seeing is a minor parsing sort of issue within >> the compiler (gcc 4.2) when mixing id with blocks. > The more fundamental problem is that gcc C++ does not fully support blocks, > period. Indeed, as soon as it gets a snif

Re: Calling getter on const object

2010-11-08 Thread Jonny Taylor
> On Mon, Nov 8, 2010 at 10:53 AM, Jonny Taylor wrote: >>// Both these have errors: "request for member 'frameNumber' >> in 'm', which is of non-class type 'objc_object* const'" >>// when compiled as Ob

Re: Calling getter on const object

2010-11-08 Thread Jonny Taylor
> I'm new at this too, so perhaps I am completely off here. My guess is that it > isn't the const that is messing this up, but the non-class type. The problem > I see is that "frame" is a pointer to an objc_object and objc_objects aren't > the same as NSObjects (but, like I said, I'm new, so may

Re: Calling getter on const object

2010-11-08 Thread Jonny Taylor
Thankyou everybody for your help (and patience!) with this one. I have indeed been making some wrong assumptions and as I result much of what I was writing was incorrect. From the various helpful replies I have received, I have (I hope!) got a much clearer understanding of what is and isn't goin

Re: Calling getter on const object

2010-11-08 Thread Jonny Taylor
010, at 16:53, David Duncan wrote: > My question is why do you need to have a 'const' pointer. > > On Nov 8, 2010, at 8:37 AM, Jonny Taylor wrote: > >> I'm afraid I'm not sure if I understand exactly what you're asking. I would >> like to be able

Re: Calling getter on const object

2010-11-08 Thread Jonny Taylor
ary > to ensure the semantics that you desire. > > On Nov 8, 2010, at 4:59 AM, Jonny Taylor wrote: > >> I have encountered what I presume is a common newcomer's problem, but I >> haven't had any luck with google (maybe I'm using the wrong search terms?). >

Calling getter on const object

2010-11-08 Thread Jonny Taylor
I have encountered what I presume is a common newcomer's problem, but I haven't had any luck with google (maybe I'm using the wrong search terms?). Suppose I have a const id, e.g. "const id frame". If I attempt to call a getter for the object I get the following compiler error: request for membe

Re: init method ambiguity

2010-11-04 Thread Jonny Taylor
>> One workaround is to include explicit casts like I have shown. However this >> leaves me wondering whether it goes against convention and/or >> recommendations to have two init methods with the same name but different >> parameter types, even for two unrelated different classes (hard to enfor

init method ambiguity

2010-11-04 Thread Jonny Taylor
Apologies for a very basic question, but unfortunately one that I don't really know what keywords to search for an answer about. Suppose I have two separate classes with init methods that have the same name, but which take different types. MyClassA has: -(id)initForCamera:(QICamera*)cam and MyCl

Re: Notifications on main thread

2010-11-03 Thread Jonny Taylor
ven though it was posted through the main thread's default queue and the main thread is still running). That sort of thing should probably put me off using them for many of the things I currently do... On 2 Nov 2010, at 18:44, James Bucanek wrote: > Jonny Taylor <mailto:j.m.tay..

Re: Notifications on main thread

2010-11-02 Thread Jonny Taylor
ny On 2 Nov 2010, at 15:21, James Bucanek wrote: > Jonny Taylor <mailto:j.m.tay...@durham.ac.uk> wrote (Tuesday, November 2, > 2010 3:01 AM -): > >> So, can anybody comment on all this? It seems like pretty bad news. Is this >> what the release notes are saying

Re: Notifications on main thread

2010-11-02 Thread Jonny Taylor
I'm reviving an old thread I posted (sorry, I can't remember who the people were who replied, but thanks again...) because I've just read something that rather alarmed me and would appreciate peoples comments. An extract from the original thread is below, and here is the code I wrote based on

Re: Custom setter for atomic property

2010-10-28 Thread Jonny Taylor
Thanks for your answers Bill, that has cleared up some of my confusion. > In the manual case, 'atomic' only has meaning if you make it meaningful. I'd > be interested in knowing why you need an atomic property in this case as > atomicity at the property level rarely contributes to thread safety

Custom setter for atomic property

2010-10-28 Thread Jonny Taylor
I currently have a property declared as follows: @property(atomic, readwrite, retain) MyFrame* latestFrame; When the value is set, I would like to broadcast a notification on the main thread, and one way of doing that would be to write my own custom setter that sets the value and then broadcasts

Release autoreleased object now

2010-10-08 Thread Jonny Taylor
Is there a way of forcing an autoreleased object to be released right now? I am encountering problems in my image processing code where I am receiving (and later discarding) a lot of large blocks of autoreleased memory in a loop. This is not getting cleaned up until the end of the loop (when I d

Should I use NSDocument, NSUserDefaults or something else

2010-09-30 Thread Jonny Taylor
Thankyou for peoples patience with my recent very basic conceptual cocoa questions. I have another where I am trying to understand the best way of handling some persistent data storage. My app is a workstation for a type of microscope, which from the point of view of the software consists of se

Re: Button performs action and then stores result to a binding?

2010-09-30 Thread Jonny Taylor
Thanks for your replies Ken. >> I have a modal dialog which, among other things, contains a number of file >> paths. There are "set..." buttons to set which files these are pointing to. > You should probably by using NSPathControl instead of displaying paths and > having "set" buttons. Ah, I had

Button performs action and then stores result to a binding?

2010-09-29 Thread Jonny Taylor
I have a modal dialog which, among other things, contains a number of file paths. There are "set..." buttons to set which files these are pointing to. I feel that with bindings I should be able to set things up automatically in InterfaceBuilder so that when that button is clicked a nav dialog is

Re: I want a window's file owner that's not a NSWindowController

2010-09-29 Thread Jonny Taylor
> Quincey Morris wrote: >> You're kind of mixing up two different tasks here. The Camera object is >> (likely) part of your data model (in the MVC paradigm). A window controller >> is a ... controller. For your settings window, you'll have least heartache >> if you make the NIB's File's Owner a

Re: I want a window's file owner that's not a NSWindowController

2010-09-28 Thread Jonny Taylor
>> I am trying to understand the right way of dealing with a "settings" window >> in my application. I have a "Camera" object that wraps a Firewire video >> camera. I would like to bring up an NSPanel that enables various settings of >> the camera to be modified. I do not need to override any pa

I want a window's file owner that's not a NSWindowController

2010-09-28 Thread Jonny Taylor
I am trying to understand the right way of dealing with a "settings" window in my application. I have a "Camera" object that wraps a Firewire video camera. I would like to bring up an NSPanel that enables various settings of the camera to be modified. I do not need to override any particular beh

Re: autorelease: how does this work!? (if at all)

2010-06-18 Thread Jonny Taylor
> First, the objects are retained by dispatch_async as others have mentioned. > Second, I'm not sure why you used 2 queues for the tasks in your code, seems > overly complex. Async queues are serialized, which means that you can > continue to add to the queue and the jobs will be done in order

Re: autorelease: how does this work!? (if at all)

2010-06-18 Thread Jonny Taylor
> [theImage release] is really suspicious. Suspicious in what way? Are you saying I am using the wrong sort of implementation for my [frame GetNSImage], and I shouldn't be returning something that requires an explicit release? Because I can certainly confirm that in its current state it leaks me

Re: Base class/subclass model in objective c

2010-06-18 Thread Jonny Taylor
Thanks for your reply Jean-Daniel. >> I can see two ways of working around this - either implement placeholder >> methods in the base class (that raise an exception or something) in order to >> make the base class conform to the protocol (knowing that in practice they >> should always be overri

autorelease: how does this work!? (if at all)

2010-06-18 Thread Jonny Taylor
I've just been looking back at some code that has been working fine for me for a while, and as far as I can see it shouldn't actually work! I'd be interested for peoples' comments. The code is as follows: dispatch_async(queue1, ^{ NSImage *theImage = [frame GetNSImage]; NSData *t

Base class/subclass model in objective c

2010-06-18 Thread Jonny Taylor
I am still getting to grips with objective C, coming from a C++ background, and I'm stuck on a particular aspect of the base class/subclass model that I hope somebody can help me with. I need an object representing a video camera plugged into the mac, a camera which may be one of several models

Re: Notifications on main thread

2010-05-20 Thread Jonny Taylor
>>> - I could try acquiring the NSNotificationQueue for the main thread, but >>> there does not appear to be a standard way of doing that. I have seen this >>> suggested as a strategy elsewhere, but I think I have also read that one is >>> not meant to post to queues other than that of the curre

Notifications on main thread

2010-05-18 Thread Jonny Taylor
Hi all, I have been programming on the mac for many years but have only just started trying to get the hang of cocoa. I have a particular question about NSNotification that I hope somebody will be able to help with. My code works with a firewire video camera, and receives callbacks from the ca