#include <DataDumper.h>
Classes | |
class | iosave |
Public Member Functions | |
DataDumper (const TableInfo &aInfo) | |
DataDumper (const TableInfo &aInfo, StringMap &aConstraints) | |
~DataDumper () | |
Destructor. | |
void | dumpAsBinary (TableData< Numeric > &aData, const std::string &aFileName) |
Dump the merged data into a binary file for later ingest. | |
template<typename DataType > | |
void | dumpAsCsv (TableData< DataType > &aData, std::ostream &aOut) |
template<typename DataType > | |
void | addDefaultRow (TableData< DataType > &aData, FitsFile &fcat) |
Dump the merged data into a binary file for later ingest. | |
bool | isDetection (std::string name) |
Private Member Functions | |
template<typename DataType > | |
bool | isUnique (TableData< DataType > &aData, unsigned aRow) |
void | formatOut (Numeric value, const std::string &format, std::ostream &os) const |
void | formatOut (Metadata value, const std::string &format, std::ostream &os) const |
Private Attributes | |
TableInfo | mInfo |
The schema info. | |
std::list< int > | mColConstList |
List of column numbers corresponding to data constraints. | |
std::map< std::string, int > | mKeyCount |
The number of occurences for different "keys". |
Class to handle the procedures for dumping the contents of a data table into a CSV file. This allows the use of constraint attributes. Only one occurence of a unique combination of the list of contraints will be output.
DataDumper::DataDumper | ( | const TableInfo & | aInfo | ) |
Constructor initialises the object taking a schema as input with no constraints
Constructor initialises the object taking a schema as input with a list of constraint attributes given in the map
References TableInfo::getAttNo(), mColConstList, and mInfo.
DataDumper::~DataDumper | ( | ) |
Destructor.
void DataDumper::addDefaultRow | ( | TableData< DataType > & | aData, | |
FitsFile & | fcat | |||
) | [inline] |
Dump the merged data into a binary file for later ingest.
Dump the contents of the input data to the output stream as comma separated variables
References TableData< DataType >::assign(), DefaultValues::bigintdef, ExpectNames::cuEventID, DefaultValues::datetimedef, ExpectNames::extNum, ExpectNames::filterID, TableInfo::getDefault(), TableInfo::getFormat(), TableInfo::getName(), TableInfo::getNumAttributes(), FitsFile::getNumHdus(), FitsFile::getNumRows(), DefaultValues::intdef, TableData< DataType >::isDefined(), mInfo, FitsFile::movabsHdu(), ExpectNames::multiframeID, TableData< DataType >::qNumExts(), TableData< DataType >::qNumRows(), DefaultValues::realdef, TableData< DataType >::setundef(), DefaultValues::smallintdef, DefaultValues::tinyintdef, TableData< DataType >::value(), DefaultValues::varchar1def, DefaultValues::varchar2def, DefaultValues::varchar3def, and DefaultValues::varchar4def.
Referenced by extractSources().
Dump the merged data into a binary file for later ingest.
Referenced by extractSources().
void DataDumper::dumpAsCsv | ( | TableData< DataType > & | aData, | |
std::ostream & | aOut | |||
) | [inline] |
Dump the contents of the input data to the output stream as comma separated variables
References TableData< DataType >::at(), formatOut(), TableInfo::getFormat(), isUnique(), mInfo, mKeyCount, TableData< DataType >::qNumCols(), and TableData< DataType >::qNumRows().
Referenced by extractMetadata(), and extractSources().
void DataDumper::formatOut | ( | Metadata | value, | |
const std::string & | format, | |||
std::ostream & | os | |||
) | const [private] |
Send the 'Metadata' value to the output stream, in ASCII format appropriate to the given SQL format type
void DataDumper::formatOut | ( | Numeric | value, | |
const std::string & | format, | |||
std::ostream & | os | |||
) | const [private] |
Send the 'Numeric' value to the output stream, in ASCII format appropriate to the given SQL format type
Referenced by dumpAsCsv().
bool DataDumper::isDetection | ( | std::string | name | ) |
bool DataDumper::isUnique | ( | TableData< DataType > & | aData, | |
unsigned | aRow | |||
) | [inline, private] |
References mColConstList, mKeyCount, and TableData< DataType >::value().
Referenced by dumpAsCsv().
std::list<int> DataDumper::mColConstList [private] |
List of column numbers corresponding to data constraints.
Referenced by DataDumper(), and isUnique().
TableInfo DataDumper::mInfo [private] |
The schema info.
Referenced by addDefaultRow(), DataDumper(), and dumpAsCsv().
std::map<std::string, int> DataDumper::mKeyCount [private] |
The number of occurences for different "keys".
Referenced by dumpAsCsv(), and isUnique().