Skip to content
Michael Iatauro edited this page Dec 5, 2014 · 3 revisions

Example of accessing custom C++ code from Java.

A new project automatically includes its own module that is loaded into the EUROPA engine and stub C++ files to hold custom code (see makeproject). How to easily extend EUROPA itself with C++ code is shown (here)[Custom-Constraints.md]. However, we have also made it easy to access your custom C++ code from Java. Consider the ExampleCustomConstraint project here, which can be downloaded with:

svn co http://europa-pso.googlecode.com/svn/benchmarks/tags/EUROPA-2.2/ExampleCustomConstraint ExampleCustomConstraint

We have added a simple 'Foo' class that is written in C++ and accessed in Java as follows:

  1. Define 'Foo' with method 'bar' in ExampleCustomConstraint.hh.
  2. Add the signature to ExampleCustomConstraint.i so that the method will be swig-wrapped.
  3. Call the method from ExampleCustomConstraint.bsh.

Note that we've also shown the same method called from the C++ side in ExampleCustomConstraint-Main.cc.

Clone this wiki locally