Other sections of this tutorial describe ContRap concepts in detail. What a person new to ContRap probably wants is to start developing plugins without reading long tutorials. This section provides a quick guide to doing so.
You will need the ContRap IDE to do certain tasks in this quick reference. Start the IDE by typing in your console:
From now on we assume that you are running the IDE in parallel to your usual coding tools like Eclipse or Emacs.
The IDE initially starts with the tool windows hidden. Go to the ''View''-menu and select ''View->Show dock'' to show the tool windows. On the borders of the IDE window three rulers will appear, with which you can draw the tool windows you like.
Before you can start developing plugins you have to create a ContRap library. Select ''File->New library'' in the ContRap IDE. The library assistant pops up and you will see something like the following:
![]() |
Simply fill out the form and press the ''Create''-button. ContRap will create the library for you. Be sure to be connected to the internet before pressing ''Create''.
The source path is the path, where you wish to store the source code of your library. The install path is the location, were the binaries of the library are placed. Per default the binary location is the same as the source location. If you check the ''Debug''-box ContRap will add debugging symbols to the library. The ''Develop''-switch forces ContRap to add the source path information to the library, so you can open plugins within the IDE by simply (right-)clicking them. If your library is inside an SVN tree, select the ''SVN integration''-box.
You can read how to create a plugin library from scratch in the Appendix C.
When you open the source directory of a ContRap library with the file browser, the corresponding CMakeLists.txt will appear in green (instead of red) indicating that you can add source files to the library in this folder. When you click the right mouse button on a source file, an option ''Add source file to library'' appears. After clicking it your plugin is integrated into the library.
![]() |
An icon indicates that the file is a part of the library.
Data types, which you want to use within ContRap must be explicitly declared. If you want to export a class type, named ''MyClass'' is derived from ''MyBase'', you write:
A type, which is used without declaration, will likely produce a segmentation fault causing ContRap to crash. Therefore, ContRap warnes you if some of the used data types were not declared. If the type ''MyClass'' is used without declaration, you will receive the following warning:
Read more about data type export here.
The only difference between a regular and a ContRap function is the ''CONTRAP_FUNCTION'' macro, which must be preprocessed by the meta-compiler of ContRap in order to generate the user-level interface. ContRap supports nearly every form of passing the parameters. Suppose, you want to export the following function:
You can, in particular, use smart pointers.
To use the above function from the ContRap user level you have to do two things. First, add the ''CONTRAP_FUNCTION'' macro to the code of the function:
Copy the source file to a source folder of a ContRap library. Inside the ContRap IDE go to the file browser and move to the directory, where you have copied the file. Add the source file to the library by right clicking it. An icon indicates that the file is a part of the library.
Be sure to properly comment your code.
Class export works analogously to function export. Suppose you have the following class, which you want to export:
public:
Pair(int a, double* b) { ... }
int get_a() { ... }
double* get_b() { ... }
protected:
int a;
double* b;
}
Essentially, all you have to do is to add the corresponding macros:
public:
CONTRAP_PUBLIC Pair(int a, SPtr<double> b) { ... }
CONTRAP_PUBLIC int get_a() { ... }
CONTRAP_PUBLIC SPtr<double> get_b() { ... }
protected:
int a;
SPtr<double> b;
}
Notice that member variables or pointer-variables of an exported class, which you pass outside the class scope, must be stored and returned as smart pointers in order to have a correct code.
After adding the source path to a ContRap library in analogy to the function export and compiling/installing the library, you can use the class inside the ContRap user-level.