fedithead  Richard J. Mathar
Fitsheaderkeywordbatcheditor
 All Classes Files Functions Variables Macros
Public Member Functions | Public Attributes | Protected Member Functions | List of all members
csv2Fits Class Reference

csv2Fits converts a file with comma-separated values to a binary FITS table. More...

#include <csv2Fits.h>

Public Member Functions

 csv2Fits (const std::string infile, const char fsep=',')
 Constructor.
 
void cnvrt (const std::string typs) const
 Scan all lines of the input file and generate the FITS file.
 

Public Attributes

std::string csvFil
 The name of the input file.
 
char fsep
 The field separator .
 

Protected Member Functions

std::vector< std::string > strtok (const std::string lin) const
 Decompose the CSV line by splitting it along commas.
 
std::vector< int > colWidths (int &lineCnt) const
 Determine the number of characters in the longest string in each column.
 

Detailed Description

csv2Fits converts a file with comma-separated values to a binary FITS table.

Constructor & Destructor Documentation

csv2Fits::csv2Fits ( const std::string  infile,
const char  f = ',' 
)

Constructor.

Parameters
[in]infileThe name of the ASCII file in CSV format.
[in]fThe field separator. This is a single character (the comma by default) which separates adjacent fields in the input file.
Author
Richard J. Mathar
Since
2013-04-30

Member Function Documentation

void csv2Fits::cnvrt ( const std::string  typs) const

Scan all lines of the input file and generate the FITS file.

Parameters
[in]typsA type string with letters a, d, f, b, i, k, and j indicating the FITS type of each column (each field in the CSV)
Author
R. J. Mathar
Since
2013-04-30
vector< string > csv2Fits::strtok ( const std::string  lin) const
protected

Decompose the CSV line by splitting it along commas.

Parameters
[in]linThe input line with any number of field separators.
Returns
The first field in the 0-th element, the 2nd field in the 1-st element etc.
vector< int > csv2Fits::colWidths ( int &  lineCt) const
protected

Determine the number of characters in the longest string in each column.

Parameters
[out]lineCtOn return this contains the number of lines in the input file. The header line with the prospective names of the columns is not counted.
Returns
A vector of maximum character widths for columns 0, 1, 2, ... etc This summarizes the widths of the associated column along all lines of the input file.
Author
R. J. Mathar
Since
2013-04-30

Member Data Documentation

std::string csv2Fits::csvFil

The name of the input file.

char csv2Fits::fsep

The field separator .

By default this is a comma. For many astronomical databases, the standard is the vertical bar (pipe symbol).


The documentation for this class was generated from the following files: