Well known data types, such as integers, floating point numbers, complex numbers, strings, vectors (1-dimensional) and arrays (multi-dimensional) are used in ODIN. For all types discussed in this section, there exists a corresponding JCAMP-DX type (JCAMP-DX implementation (odinpara library)). This JCAMPD-DX type is prefixed by 'JDX' and then the data type, e.g. 'STD_string' has a JCAMP-DX counterpart 'JDXstring' with the same functionality. In addition, JCAMP-DX parameters can be assigned a label, grouped together with other JCAMP-DX parameters, etc.
Vectors are implemented by the tjvector template class which is derived from the STL vector class. Its interface is therefore equivalent to that of the std::vector class. In addition, some useful functions are added. Some predefined vector classes are created by using the tjvector template class:
Multidimensional arrays are covered by the tjarray template class. It is derived from the tjvector class to store the data. In addition, the information about the dimensionality and extent in each dimension is stored separately in the class by an ndim object. Some predefined array classes and their corresponding JCAMP-DX type are created by using the tjarray template class:
Some examples on how to use these arrays:
farray fa1(3,3); // creates a 2-dimensional 3x3 array fa1(0,1)=5.7; // assigns 5.7 to the second element in the firs row farray fa2(3,3); // creates another 2-dimensional 3x3 array fa1+fa2; // returns the element-wise sum of the two arrays fa1.redim(1,2,3); // resizes fa1 to a 3-dimensional 1x2x3 array
Please see the class documention for a complete reference.