• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Cocoa/Windows parallel dvlpmt
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cocoa/Windows parallel dvlpmt


  • Subject: Re: Cocoa/Windows parallel dvlpmt
  • From: Erez Anzel <email@hidden>
  • Date: Mon, 2 Feb 2004 12:19:03 -0500

I'm happy (and reassured), John, to hear of your positive experience with STL and Cocoa. I use STL, mostly for collections (vectors, specifically) within the C++ core of my app. I had originally developed it in CodeWarrior with PowerPlant, but switched to Cocoa several months ago, and to XCode 1.1 more recently. I haven't had any problems in this regard.

Why did you use plain vanilla Win32 instead of MFC? I have a fair amount of UI in my CAD-like app, and am looking for the fastest and easiest route to port to Windows. I figure on using Visual C++ and MFC, but I'm basing that on no real knowledge or experience.

I'm not sure about efficiency: at what level should I draw the line between Cocoa and STL? For instance, should my MVC model (containing perhaps as many as 100,000 objects) use an STL vector for those objects? Or should it keep an NSMutableArray for the Mac, and something else for Windows?

If an STL vector, then how should I tell each object to draw itself in the NSView subclass which I (currently) pass it? (I can have multiple views, each displaying all of the objects simultaneously.) When my data changes, I typically iterate first through the views; each view then tells the model to redraw its objects, passing it the view so that the objects will know the drawing scale etc. (each object knows its real-world coordinates, not its window coordinates). (Often a change in one data object requires much (if not all) of each view to be redrawn due to impact on other objects.) Maybe I should be passing specific view parameters, instead of the platform-specific view object. The data object's drawMyself method can call platform-specific scaling and drawing methods depending upon the platform (determined at compile time).

Help wanted: Any advice on whom to turn to, or how to find someone to turn to, to help with the design and porting? I'm in Toronto, Canada, but I suppose a long-distance relationship can also work.

TIA...Erez

On 2-Feb-04, at 10:03 AM, John Stiles wrote:

On Jan 31, 2004, at 3:52 PM, Darrin Cardani wrote:

Or should I use STL lists or vectors, and then in Cocoa have
a model object which owns the STL list of raw C++ objects, and do
likewise in Windows.

As I understand it, you can't use STL in Cocoa code. If nothing else, you'll have problems with templates because of the "<>" bracket syntax, if I recall correctly.

This is not true at all.

I love Cocoa as well as STL. Mixing them is easy and works quite well. Obviously you can't pass a vector<> to something that expects an NSArray*, etc, but there is no reason why STL can't be used in a Cocoa app.

My largest Cocoa-based project is actually C++ at its core--I wrote a large body of platform-neutral code, and then a front-end for Mac OS (Cocoa) and Win32 (plain vanilla, not MFC); it was also easy to port to Linux (SDL) as a portability test. All the cross-platform stuff was done with C++ objects and a handful of templates, and the compiler doesn't even skip a beat.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Cocoa/Windows parallel dvlpmt
      • From: Chris Hanson <email@hidden>
    • Re: Cocoa/Windows parallel dvlpmt
      • From: Allan Odgaard <email@hidden>
    • Re: Cocoa/Windows parallel dvlpmt
      • From: Andy Satori <email@hidden>
References: 
 >Re: Cocoa/Windows parallel dvlpmt (From: John Stiles <email@hidden>)

  • Prev by Date: Re: Packager
  • Next by Date: Re: Cocoa/Windows parallel dvlpmt
  • Previous by thread: Re: Cocoa/Windows parallel dvlpmt
  • Next by thread: Re: Cocoa/Windows parallel dvlpmt
  • Index(es):
    • Date
    • Thread