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
- cd xmlcasa/implement/images
- 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"
- 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.)
- emacs image_cmpt.cc implement the function with the same signature as in the generated build/xmlcasa/impl/image_cmpt.h
- 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++ CMPT |
CASA library |
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 |
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)