| Getting Started | Documentation | Glish | Learn More | Programming | Contact Us |
| Version 1.9 Build 803 |
|
Once you have created your DO class, it is remarkably easy to create a server executable to embed it in.
Here is the main program for a DO server executable:
#include <aips/Tasking.h>
#include <your includes go here>
int main(int argc, char **argv)
{
ObjectController controller(argc, argv);
controller.addMaker("squarer", new StandardObjectFactory<squarer>);
controller.loop();
return 0;
}
You can call addMaker() for as many different classes as you want to embed in the current server. Generally you will want to group multiple classes of similar purpose (e.g, synthesis processing) into one server executable to amortize the amount of disk and memory use used by the greedy C++ compilers. So, for example, the numerics server is used for FFT's, fitting and the like, and the image server is used to serve DO's for all image-plane only functionality. Note that the ObjectController will delete the factory when it is done with it -- you must not delete the pointer yourself.
A Factory is a class that knows how to create another class. In particular, StandardObjectFactory<type> is a class that know how to create objects of any type that has a default constructor. Currently with the GNU compiler you will need to create an extra line in the templates for each new use of StandardObjectFactory<T>.