Tool methods are defined in, and also defined in foobar.xml. The 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 file will probably not match changes in the .xml unless you've done this 20 times before.)
  4. emacs implement the function with the same signature as in the generated build/xmlcasa/impl/image_cmpt.h
  5. gmake - if your changes to 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++ CMPT CASA librarySorted descending Python
string[]   StringVec sequence<string> StringVecSeq std::vector<std::string> Vector<String> PyList
long[]   LongVec sequence<long long> LongVecSeq std::vector<long long> Vector<Int64> PyList
int[]   IntVec sequence<long> IntVecSeq std::vector<long> Vector<Int> PyList
double[]   DoubleVec sequence<double> DoubleVecSeq std::vector<double> Vector<Double> PyList
complex[]   ComplexVec sequence<complex> ComplexVecSeq std::vector<std::complex<double>> Vector<DComplex> PyList
bool[]   BoolVec sequence<boolean> BoolVecSeq std::vector<bool> Vector<Bool> PyList
string   string string char * std::string String PyString
record   record any any record Record PyDict
quantity   quantity any any record Quantity PyDict
Object (e.g., Table)   Object Object Object* Object* Object* PyObject
measure   measure any any record Measure PyDict
long   long long long long long long long Int64 PyLong
int   int long long int Int PyInt
double   double double double double Double PyFloat
complex   complex struct complex complex std::complex<double> DComplex PyComplex
bool   bool boolean bool bool Bool PyBool

XML Layout of tool/task interface: CASAToolLayout

more examples

  • how to use a variant as a string or stringArray: code/xmlcasa/implement/images/
::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