#include <public/manip.h>#include <public/defman.h>namespace { using namespace falcON; class foobar : public manipulator { public: const char* name() const; const char* describe const; fieldset need() const; fieldset change() const; fieldset provide() const; bool manipulate(const snapshot*) const; foobar(const double *pars, int npar, const char *file); ~foobar(); }; } __DEF__MAN(foobar)The foobar class gets compiled into a shared object foobar.so, and is required to have a specific type of constructor and a number of member functions. The __DEF__MAN macro will then create an extern "C" function, called inimanip, which can be loaded by the dynamic object loaded (see also loadobj(3NEMO) ). It will instantiate a foobar object, and made available to the ...
On the "server" side, i.e. the code that needs to initialize and distribute the work, the Manipulator class constrols this.
class Manipulator;
From a users perspective a
name must be given to find the manipulator (typically the class name),
as well as an optional set of parameters and files for that manipulator.
As usual these will present them to the user as a set of keywords:
manipname= name of the manipulator (multiple can be given, see below) manippars= a set of parameters this manipulator will understand (optional) manipfile= a set of character strings, ususally one or more files (optional) manippath= search path (or use $MANIPPATH if left blank???) manipinit= ? manipulate initial snapshot ? [specific to gyrfalcON]Multiple manipulator can be given, and are processed in the order given on the manipname= keyword. Here is an example:
manipname=name1+name2+name3manippars=#1,2,3#manipfile=file1##file3a,file3bwhere the first manipulator has no parameters, and one file, the 2nd manipulator has 3 parameters given, and no file, and the third has no parameters and 2 files. Instead of the # symbol to separate parameters or files, the ; can also be used. For manipulator names the , symbol can also be used to separate their names.
host1% mkexpdisk disk1 50000 host1% gyrfalcon in=disk1 out=disk1.out step=100 manipname=glnemo host2% glnemo server=host1This particular manipulator is only using manippars as an optional keyword, and is interpreted as a single integer denoting the port number on which glnemo is talking (port=444 in glnemo)
http://www.tntnet.org/cxxtools.bhtm for another c++ wrapper example to loadobj
NEMO/usr/dehnen/falcON tree code that accepts manipulators, plus some examples NEMO/src/nbody/glnemo/manipulators example glnemo manipulator NEMO/usr/dehnen/falcON/manip repository of compiled manipulator files NEMO/obj/manip repository of compiled manipulator files
7-nov-05 initial man page written PJT