I finally have a very basic version of my graph searcher working through a CLI, but I find myself in a position where I need to refactor all of the code. Since I am doing this programming on a mac, I was thinking of using Cocoa for the GUI, and then having my C++ functions underneath as workhorses. This would just be a temporary fix, as eventually I want to be able to run all of my code on a linux box/cluster. Here is my last question about the implementation, and I did get this working in boost, rolling my own graph functions (for now).
So here was my thought: Build the C++ classes for the graph itself, and either separate functions or methods for the quantities I want to compute. This is the latest description that I can find that deals with mixing Objective-C and C++. But I was wondering:
Will compiling my C++ code in Xcode be optimized? The whole point is that I want the C++ code to be fully optimized for fast memory access, multiple threads, and have access to the boost libraries. Then, I can encapsulate the C++ class in a wrapping ObjectiveC class. To do this, I would essentially have 2 classes, correct? The C++ class with a .h and .cpp file and included boost libraries, and then the ObjC class wrapper with a .h and .mm file, where the .h does not contain any reference to the C++ class, I use the include in the .mm file. Then I can use my normal MVC design and GUI implementation for Objective C. As long as I give the dealloc command the ability to nuke the C++ class, I don't have to worry about memory management? Does ARC work well with C++ as well, and does it give OSX the ability to memory manage and clean up my C++ code?
I suspect that if I want threading, I would go with the boost threading, since coding for the GCD would make it platform specific (although for now, this is all it will run on). I think that for now, I will stay away from the Core Data, since I create my graph by simply parsing a text file.
Will compiling my C++ code in Xcode be optimized?
It's not Xcode that compiles your code, it's the compiler (GCC or clang), and it will optimize your code if you request it to do so using the appropriate compiler flags. I don't see how mixing C++ and Objective-C would make the compiler not optimize...
As long as I give the dealloc command the ability to nuke the C++ class, I don't have to worry about memory management?
Specifically? You still do have to manage memory for both C++ and Objective-C objects as normally.
Does ARC work well with C++ as well?
No, it doesn't, it's an Objective-C feature. C++ doesn't even have reference counting (I wish it had...).