swarm-modeling
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Swarm-Modelling] Floating point arithmetic


From: Marcus G. Daniels
Subject: Re: [Swarm-Modelling] Floating point arithmetic
Date: Sat, 07 May 2005 15:47:27 -0600
User-agent: Mozilla Thunderbird 0.9 (Windows/20041103)

Paul Johnson wrote:

I have wondered what a C++ program of that sort would look like. Do you have any working example?

Hmm, I had some, but it seems SFI lost the old Swarm CVS tree. (The machine crashed and they haven't found any backups.)

The COM support is in the normal Swarm source tree, though. It requires a Mozilla or Firefox build for the XPCOM infrastructure. I think it would be relatively easy to adapt to Microsoft .NET, but I never tried. COM or XPCOM (a.k.a. Cross Platform COM) is essentially a C++ interface, but one that follows certain conventions to facilitate interoperability with other languages. For example XPCOM interfaces can be called by Python and JavaScript in the Firefox web browser.

I'm wondering, for example, is there a ModelSwarm.m from Obj-C and then a C++ file Agent.cc that somehow get put together? Or is it like the JNI interface, where it is all in Java and then the OBJC classes get linked in?

The latter. The Swarm C++ user imports C++ headers (not Objective C headers). The user then links against a C++ version of the Swarm library which in turn links against the Swarm kernel. It's basically just like the Objective C Swarm workflow (Makefiles and so on), but instead of calling the Objective C compiler it calls the C++ compiler.

The only sense in which Objective C is exposed is in the sense that there is the possibility (but not the necessity), of messages disembodied from classses; there is a class for Selectors. So the C++ user doesn't need to know about Objective C notions unless they want to use dynamic method invocation from the Swarm scheduler. (They can also use fixed class targets with methods that are known to work.)

The headers are generated from the abstract description of Swarm interfaces, namely the Swarm Objective C protocol files (just as it is for the Swarm documentation and Java layer). The C++ implementation is also generated, but all the implementation does is the object conversions as is done for the JNI layer. These techniques were reasonably well-optimized for Java, and COM inherits most of that.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]