LTAFMT: ~~~~~~ A C++ interface for handling LTA format files. Using this, now C++ applications can handle more than one LTA file. This object makes an important component of an object liberary that we will eventually have (which will be used to connect our software to AIPS++). Even this one probably needs to be broken into smaller objects - but that is a matter of detail and discussion. Methods: ~~~~~~~ LTAFMT(); The default constructor. This will construct a blank object. Before using any of the methods, one will have to use the "reset" method. LTAFMT(char *i, char *f=NULL); An alternate constructor which will attach the file given by the first string to the input stream and file given by the second string to the output stream. If the second string is missing, it will attach the output stream to the stdout. ~LTAFMT(); The destructor. This will be called whenever the object goes out-of-scope in the application program. This will release all the resources the object had grabbed for working. int reset(char *i, char *f=NULL); A method to reset the input and the output streams of the object after it has been instantiated (using one of the above constructors). It also resets all the internal parameters which affect the operations on a LTA file. FILE *getInpfd(); Returns the file descriptor of the input file attached to the input stream. int append(LTAFMT&); Appends the given LTAFMT object to the current object. Because of limitation of the space allocated in the global header for writing the scan offsets, the maximum number of scans that can currently be put in a single LTA file is limited to 55. This number however can be slightly increased by optimal use of the space currently allocated for the list in the global header. int skipscan(int n); Skips n scans from the input stream. This method will not work when the input stream is stdin. int skiprec(int n); Skips n records from the input stream. This method will not work when the input stream is stdin. int rd_data(char *); Read the next record from the input stream into the character buffer supplied in the argument. int rd_data(); Read the next record from the input stream into an internal buffer. int wt_data(char *); Write the record from the buffer supplied by the caller. int wt_data(); Write the internal buffer to the output stream. char *getDataBuf(); Return the pointer to the internal data buffer. The internal buffer is allocated the first time it is required by the object. int getNFFT(); Get the no. of correlator FFT pipelines detected from the data. int getNoOfBase(); Get the no. of baselines detected in the data. int getNoOfChans(){return NoOfChans;}; Get the no. of channels detected in the data. void getChanList(intVec &chanlist); Get the list of freq. channels present in the data. void getBaseList(intVec &baselist); Get the list of baselines present in the data. void getSelfs(int, int *, int *); Given the baseline number as the first argument, returns the two MAC numbers which has the self correlations of the two antenna which make the given baseline. int getFFTMac(struct fftmac *); Fills the fftmac structure to reflect the mapping between the FFT and MAC. The struct also has all the antenna based information. void getAntTab(struct AntCoord *); Fill the given structure with the antennae table from the header. Operators: ~~~~~~~~~ int operator==(const LTAFMT &); Checks if the given LTAFMT object is "equivalent" to the current LTAFMT object. The two objects are called equivalent when the following keywords have the same value in the global header: RECL, DATASIZE, DATA_OFF, PAR_OFF, BASELINE, CHANNELS, LTA, INTEG, BASE_NUM, CHAN_NUM LTAFMT operator+(LTAFMT &); Appends the given LTAFMT object to the current object. ***** THIS IS NOT YET OPERATIONAL ***** Services for header I/O: ~~~~~~~~~~~~~~~~~~~~~~~ void gwrthdr(); Write the global header to the output stream. void gprthdr(); Write the global header to the stdout. int ggetval(char *, float *); Get the value of a given keyword from the global header. Returned value is of the type float. int ggetval(char *, double *); Get the value of a given keyword from the global header. Returned value is of the type double. int ggetval(char *, int *); Get the value of a given keyword from the global header. Returned value is of the type int. int ggetval(char *, char *); Get the value of a given keyword from the global header. Returned value is of the type char * (string). int gputval(char *, float); Get the value of a given keyword in the global header. The value is of the type float. int gputval(char *, double); Get the value of a given keyword in the global header. The value is of the type double. int gputval(char *, int); Get the value of a given keyword in the global header. The value is of the type int. int gputval(char *, char *); Get the value of a given keyword in the global header. The value is of the type char * (string). int gputhistory(char *); Put history record in the global header. Following are the equivalent services that work on the current SCAN header. void sprthdr(); void swrthdr(); int sgetval(char *, float *); int sgetval(char *, double *); int sgetval(char *, int *); int sgetval(char *, char *); int sputval(char *, float); int sputval(char *, double); int sputval(char *, int); int sputval(char *, char *); int sputhistory(char *); ----------------------------------------------------------------------- Policy regarding handling input data from a pipe: ------------------------------------------------ 1. A file name begining with "<" is treated to be an indicator of input from a pipe. The string from first character till a NULL character is used as an argument to popen UNIX sys. call (which starts a shell, runs the given string as a command in that shell and connects the stdout of the shell to the stdin of the process which issued the popen call). This policy is also installed in hlib.c. 2. LTAFMT::skipscan(int n) In case of a pipe, does nothing and returns LF_CANTSKIP. This should probably throw an exception with the error state of the exception object set to LF_CANTSKIP. LTAFMT::init(): This functions initializes the object state. This makes the call to open the data base and make the summary using the SCANINFO object. In case of pipe, this does not make the summary. LTAFMT::skiprec(int n) This function skips n records from the current position in the database. In case of a pipe, this eats n*RECLEN no. of bytes from the pipe and returns. In case of a input from a disk file, this does an fseek.