Tool methods are defined in foobar_cmpt.cc, and also defined in foobar.xml. The foobar_cmpt.cc is compiled against a foobar_cmpt.h which is generated from foobar.xml. You have to make changes in both places, and the system is quite picky about making the changes consistently in both places. There appear to be two approaches: "walk forwards into the dark", and "walk backwards in a circle". Both are probably required in practice, and here is an example:
(from Kumar:) to add a method to the image tool
  1. cd xmlcasa/implement/images
  2. emacs image.xml - this is the walking into the dark. a good example of the xml file structure is CASAToolLayout, and a table describing the different types of tags is below "Type Mapping Summary"
  3. gmake (expecting it to fail because the image_cmpt.cc file will probably not match changes in the .xml unless you've done this 20 times before.)
  4. emacs image_cmpt.cc implement the function with the same signature as in the generated build/xmlcasa/impl/image_cmpt.h
  5. gmake - if your changes to image_cmpt.cc and image.xml match, you now have some hope of the modified tool compiling.

The build will stop if there is an error parsing the xml.

Type Mapping Summary

TYPE STAGE XML IDL CORBA C++ CMPTSorted ascending CASA library Python
bool   bool boolean bool bool Bool PyBool
double   double double double double Double PyFloat
int   int long long int Int PyInt
long   long long long long long long long Int64 PyLong
Object (e.g., Table)   Object Object Object* Object* Object* PyObject
quantity   quantity any any record Quantity PyDict
measure   measure any any record Measure PyDict
record   record any any record Record PyDict
complex   complex struct complex complex std::complex<double> DComplex PyComplex
string   string string char * std::string String PyString
bool[]   BoolVec sequence<boolean> BoolVecSeq std::vector<bool> Vector<Bool> PyList
double[]   DoubleVec sequence<double> DoubleVecSeq std::vector<double> Vector<Double> PyList
int[]   IntVec sequence<long> IntVecSeq std::vector<long> Vector<Int> PyList
long[]   LongVec sequence<long long> LongVecSeq std::vector<long long> Vector<Int64> PyList
complex[]   ComplexVec sequence<complex> ComplexVecSeq std::vector<std::complex<double>> Vector<DComplex> PyList
string[]   StringVec sequence<string> StringVecSeq std::vector<std::string> Vector<String> PyList

XML Layout of tool/task interface: CASAToolLayout

more examples

  • how to use a variant as a string or stringArray: code/xmlcasa/implement/images/image_cmpt.cc
::casac::image * image::imageconcat(const std::string& outfile, const ::casac::variant& infiles, const int axis, const bool relax, const bool tempclose, const bool overwrite)
Topic revision: r2 - 2010-07-13, JonasLarsen
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding NRAO Public Wiki? Send feedback