Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1] 2
Print
Author Topic: C++  (Read 37988 times)
trilec
Sr. Member
****
Posts: 52



View Profile WWW Email
C++
« on: May 29, 2008, 07:30:57 »

Anyone looking at this or interested in?

C++ / STL or some form

Trilec
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 on: May 29, 2008, 07:38:04 »

Nobody's on it yet. Would you like to give it a whirl?

-=Cliff>
Logged
trilec
Sr. Member
****
Posts: 52



View Profile WWW Email
« Reply #2 on: June 25, 2008, 01:31:53 »

Ive started looking at it but was trying to get a feel for who else might be interested and C++ and understands some of the possible issues data storage/multi core id/approch etc and of course more minds are better.
I was concidering using stl map functions but perhaps a fast and simple hash table could be used instead of using the STL or ever STL vector class and passing a reference into the array for the ID fastest method.
another question is how much to emulate flash data structures or just keep witl STL etc

comments welcome
curt [Trilec]

Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #3 on: February 05, 2009, 11:35:26 »

I've heard independently from a few folks this week on the 'why isn't there a c++' topic. I thought I'd post my last thoughts here:

The big issue with C++ will be the number of strains out there. Based on the wikipedia page's 'Major implementations', at a minimum, we need to expect branches for Microsoft Visual C++, GCC, Borland C++ Builder, Intel C++ Compiler, Sun Studio.

We’d need to kick the project off with at least one of these. I don’t know enough about the similarities, and how people handle C++ projects that are intended to compile to multiple platforms. Since we make no dependencies on anything but the language itself as a rule, if there was a proto-implementation on the trunk which could be branched to make the others, maybe we’d get them all going fast.

Then there's the issue of how to publish utilities and demos so that they'll work across as many versions as possible.

I'd be really happy to hear anyone's input on how to handle this.

-=Cliff>

Logged
efnx
Newbie
*
Posts: 8


View Profile Email
« Reply #4 on: February 08, 2009, 11:48:41 »

I don't have much input on how to implement a fully cross compilable pmvc arch, but I can suggest starting with GCC. Besides ubiquity I one detail that escapes me is what components of the mvc arch will need to be threaded? Or will they?

A C++ port would greatly improve my software cycle, as I could rapid prototype in flash and then port to C++, hopefully with ease. Has anyone started?
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #5 on: February 08, 2009, 06:11:37 »

So far no one has said they're actually working on the port. I agree GCC is the place to start.

If you decide to give this a try, chat with me if about packaging first. It should follow the basic structure that the other ports follow.

I think you probably want to port MultiCore.

The namespace would be:

org.puremvc.cpp.multicore.*

If you want to port the standard version, it would be


org.puremvc.cpp.*

See the Java MultiCore and C# ports an talk with the port owners in their forums for info on what they've done on the thread saftey issue.

Also if you do decide to do it, let us know here so no one else starts.

Cheers,
=Cliff>
Logged
efnx
Newbie
*
Posts: 8


View Profile Email
« Reply #6 on: December 17, 2009, 02:19:02 »

Hi guys! About a year later, I'm bumping this topic. I had some time recently so I decided to give the port a go. As of right now I haven't taken packaging into consideration, I've just been getting the meat of the project done. I took a semi test driven approach to the development so there are unit tests (using cxxtest) written for the port. I completed a rough draft and a small sample application. Everything has been compiled successfully on Linux (Ubuntu Karmic 32bit) and Os X (Snow Leopard 64bit). The documentation may not totally make sense at the moment, it's pretty much just ripped from as3. Hold on a moment while I get the source up and available for download...
Logged
efnx
Newbie
*
Posts: 8


View Profile Email
« Reply #7 on: December 17, 2009, 02:58:40 »

Okay - two ways for you to get the source...

via git/github:
http://github.com/efnx/PureMVC-Plus-Plus

via svn/my server:
https://efnx.com/svn/pmvcpp

From github you can download a zip of the files, so there's a third option as well...
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #8 on: December 18, 2009, 08:32:25 »

Awesome. It resembles PureMVC. I need to look at it a little more to see if anything obvious pops out.

If it's possible to do without some sort of IBody wrapper, I'm pretty sure you're going to want the body of notifications to be of type Object. Its a central premise of the framework that you can toss *anything* over the fence from the model tier to the view tier or from the view tier to the controller tier. Frequently these are value objects, or even primitives like ints and booleans coming from the model, and occasionally view components going from the model to the controller or visa versa. So having everything that you want to send as a note body have to implement the IBody interface is going to be pretty limiting.

Also, do you plan to split these classes into their own files and packages following the reference? I used to do this in perl. I called it the Unified File Theorem - put everything in one big file. It helped somewhat with the parser overhead since perl is interpreted. But it sure makes exploring an object-oriented system a pain.
 
-=Cliff>
« Last Edit: December 18, 2009, 08:47:33 by puremvc » Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #9 on: December 18, 2009, 09:00:42 »

Also, if you are willing to release the port under CC, and include in your class comments the attribution required by the license of the AS3 reference implementation, I'll be happy to set up as a project owner here here in the repository with all the other ports.

-=Cliff>
Logged
efnx
Newbie
*
Posts: 8


View Profile Email
« Reply #10 on: December 18, 2009, 01:22:22 »

Thanks!
As far as IBody is concerned, there's a trick. Unlike AS3, C++ has no fundamental data type that others inherit from. As far as I know, one can't pass an int or a float or a char as a more generic object, then cast to a more specific object. For PureMVC's notification system, in order to be able to pass many objects we're going to need some defined generic data type. Right now that is IBody. I could easily change it to Object, though the programmer is still required to define a class for their notification body that extends IBody/Object. There may be a way to get around this using templates, but I'm not sure. I can experiment.
There's another change I made in notifications. In C++ you can't switch on strings. You can only switch on ints, so I changed the notification names and types to ints to make it easier on the programmer. This then makes the programmer able to enumerate notification names and types. It's much easier.

As for splitting the classes - I'm cool with that, though it seems to be the norm to have as small a number of files to include as possible. I think that's because it can be a real pain fiddling with include directives, config options and compiling (then linking) options in your IDE (or worse, your makefile). Essentially, each cpp file included in the project will have to be compiled and then linked, requiring your makefile to have lots of rules, targets and commands. I just want to make it as easy as possible. (I'm also a C++ newb so if you know of how to make this easy please interject).

CC = creative commons? If that's the license with the most freedoms, I'm down. That would be cool. Should I just add the license blurbs from the AS3 version to my source files?
Logged
efnx
Newbie
*
Posts: 8


View Profile Email
« Reply #11 on: December 18, 2009, 02:56:52 »

Okay - First off I took the project out my svn. It's now hosted solely from github.

I changed all the IBody references to Object.
I added the CC license thingy.
I added a namespace of 'PureMVC' to avoid any conflicts.

I haven't split up the files yet, or added complicated namespacing. I think it would be nice to keep it simple, but I'd like to have some C++ people agree with me. Or tell me otherwise.

Again, the updated source is here: http://github.com/efnx/PureMVC-Plus-Plus
Logged
efnx
Newbie
*
Posts: 8


View Profile Email
« Reply #12 on: December 18, 2009, 04:30:05 »

Here I have posted some of the differences (currently) between the AS3 and C++ versions of the PureMVC architecture:
http://blog.efnx.com/puremvc-a-c-mvc-framework-ported-from-as3
Logged
efnx
Newbie
*
Posts: 8


View Profile Email
« Reply #13 on: December 19, 2009, 12:28:20 »

I figured out what to use instead of the base class 'Object'. void* pointers! I totally missed void pointers in my intro to c++, so I'll be re-writing that now...
Logged
efnx
Newbie
*
Posts: 8


View Profile Email
« Reply #14 on: December 19, 2009, 05:12:56 »

All Object references have been replaced with void*. This also enabled me to merge IProxyRestriced and IProxyTemplated into IProxy, like in the as3 port. Ditto with IMediator.
Logged
Pages: [1] 2
Print