AccessGrid.org

Developer Example: AG from C/C++

The AG toolkit has tools that can be useful in many applications.
Often existing applications or performance critical applications can
be written in languages such as C or C++ instead of python.

Giving collaborative capabilities to these applicationss can be handled by using
swig or ctypes to make the application accessible to the Access Grid
tools.

In some cases, adding Access Grid tools to the c or c++
application is desirable.

For example, adding networking to a c++ application can be done by writing
network socket code in c++, but another option is to reuse the Access Grid
networking code to send events.

The following examples show how to execute python and Access Grid code
fronm c++.

Examples
The examples are compiled with c++, but they should work in c without major
changes.

1) A simple c++ application that prints hello world from python.
2) A simple Access Grid application that prints the current participants
in a venue.
3) A application that makes some shared application calls and also shows
how to iterate a main loop in c++.

Data structures
Mapping a data structures between c++ and python can also
be done.

Simply passing simple types like strings between c++ and python is easier, but the effort may be worthwhile enough for some applications to write the python adapter.
Simply passing strings between c++ and python strings is easier, but the effort may worthwhile for some applications to define your classes as new python types.
http://docs.python.org/ext/defining-new-types.html

Going further
Do you have existing c or c++ apps that would benefit from using AG
infrastructure tools?
Do you have applications that would benefit from being published in
a venue (as a shared app?) when they're started so users could easily
join.
Are there any new applications you can think of that would
benefit from this?

AttachmentSize
cppAgExample2008.zip8.19 KB

login or register to post comments