#include <CifSchemaMap.h>
Collaboration diagram for DbLoader:
Public Types | |
eDATA_ONLY = 0 | |
eDATA_WITH_SCRIPTS | |
eSCRIPTS_ONLY | |
enum | eConvOpt { eDATA_ONLY = 0, eDATA_WITH_SCRIPTS, eSCRIPTS_ONLY } |
Public Member Functions | |
DbLoader (SchemaMap &schemaMapping, DbOutput &dbOutput, bool verbose=false, const string &workDir=std::string()) | |
virtual | ~DbLoader () |
void | SetWorkDir (const string &workDir) |
void | AsciiFileToDb (const string &asciiFile, const eConvOpt convOpt) |
void | SerFileToDb (const string &serFile, const eConvOpt convOpt) |
void | FileObjToDb (CifFile &cifFile, const eConvOpt convOpt) |
Private Member Functions | |
void | _LoadBlock (Block &rBlock, Block &wBlock) |
bool | _Search (vector< vector< string > > &dMap, const unsigned int iAttr, ISTable *isTableP, const string &blockName, const vector< string > &cNameMap, const string &sItem, const string &sCnd, const string &sFnct) |
void | _DoFunc (vector< string > &s, const vector< string > &r, const string &sFnct) |
void | _OpenLog (const string &logName) |
int | _GetMapColumnIndex (const vector< string > &cNameMap, const string &vOf) |
void | _GetMapColumnValue (string &p, vector< string > &dMapVec, unsigned int irow) |
void | CreateTables (CifFile &writeCifFile, CifFile &readCifFile) |
void | _ReorderName (string &res, char *string, int mode) |
void | _ToUpperString (string &aString) |
void | _StripString (string &aString, int mode) |
void | Clear () |
Static Private Member Functions | |
static void | CleanString (string &aString) |
Private Attributes | |
string | _workDir |
string | _INPUT_FILE |
string | _blockName |
bool | _verbose |
std::ofstream | _log |
SchemaMap & | _schemaMapping |
DbOutput & | _dbOutput |
Static Private Attributes | |
static const string | _LOG_FILE = "SchemaMap.log" |
This class controls the conversion process of CIF data to DB loadable data. It provides methods for its construction/destruction, conversion of ASCII CIF files, conversion of serialized (binary) CIF files, conversion of in-memory CIF file objects, setting the working directory. Data conversion methods can be instructed to generate: only the data loading files, only the data loading shell scripts or both the data and scripts. DB server data loading is accomplished by executing the generated loading shell scripts, which utilize the data loading files, obtained during the conversion process.
enum DbLoader::eConvOpt |
DbLoader::DbLoader | ( | SchemaMap & | schemaMapping, | |
DbOutput & | dbOutput, | |||
bool | verbose = false , |
|||
const string & | workDir = std::string() | |||
) |
Constructs a CIF to DB controller object.
[in] | schemaMapping | - reference to the schema mapping object |
[in] | dbOutput | - reference to the database output object |
[in] | verbose | - optional parameter that indicates whether logging should be turned on (if true) or off (if false). If verbose is not specified, logging is turned off. |
[in] | workDir | - optional parameter that indicates the working directory in which the files will be placed. If workDir is not specified, current process working directory is used. |
None |
DbLoader::~DbLoader | ( | ) | [virtual] |
Destructs a CIF to DB controller object.
Not applicable |
None |
void DbLoader::_DoFunc | ( | vector< string > & | s, | |
const vector< string > & | r, | |||
const string & | sFnct | |||
) | [private] |
int DbLoader::_GetMapColumnIndex | ( | const vector< string > & | cNameMap, | |
const string & | vOf | |||
) | [private] |
void DbLoader::_GetMapColumnValue | ( | string & | p, | |
vector< string > & | dMapVec, | |||
unsigned int | irow | |||
) | [private] |
void DbLoader::_LoadBlock | ( | Block & | rBlock, | |
Block & | wBlock | |||
) | [private] |
void DbLoader::_OpenLog | ( | const string & | logName | ) | [private] |
void DbLoader::_ReorderName | ( | string & | res, | |
char * | string, | |||
int | mode | |||
) | [private] |
bool DbLoader::_Search | ( | vector< vector< string > > & | dMap, | |
const unsigned int | iAttr, | |||
ISTable * | isTableP, | |||
const string & | blockName, | |||
const vector< string > & | cNameMap, | |||
const string & | sItem, | |||
const string & | sCnd, | |||
const string & | sFnct | |||
) | [private] |
void DbLoader::_StripString | ( | string & | aString, | |
int | mode | |||
) | [private] |
void DbLoader::_ToUpperString | ( | string & | aString | ) | [private] |
void DbLoader::AsciiFileToDb | ( | const string & | asciiFile, | |
const eConvOpt | convOpt | |||
) |
Converts an ASCII CIF file to DB loadable data with/without generating loading scripts. The specified file is first parsed and then converted.
[in] | asciiFile | - indicates the name of the ASCII CIF file, which is to be converted. |
[in] | convOpt | - indicates data conversion options: generate data only, generate data with loading scripts, generate loading scripts only. |
None |
void DbLoader::CleanString | ( | string & | aString | ) | [static, private] |
void DbLoader::Clear | ( | ) | [private] |
void DbLoader::CreateTables | ( | CifFile & | writeCifFile, | |
CifFile & | readCifFile | |||
) | [private] |
void DbLoader::FileObjToDb | ( | CifFile & | cifFile, | |
const eConvOpt | convOpt | |||
) |
Converts an in-memory CIF file object to DB loadable data with/without generating loading scripts.
[in] | cifFile | - a reference to the in-memory CIF file object, which is to be converted. |
[in] | convOpt | - indicates data conversion options: generate data only, generate data with loading scripts, generate loading scripts only. |
None |
void DbLoader::SerFileToDb | ( | const string & | serFile, | |
const eConvOpt | convOpt | |||
) |
Converts a serialized (binary) CIF file to DB loadable data with/without generating loading scripts. The specified file is de-serialized (without the need to parse it) and converted.
[in] | serFile | - indicates the name of the serialized (binary) CIF file, which is to be converted. |
[in] | convOpt | - indicates data conversion options: generate data only, generate data with loading scripts, generate loading scripts only. |
None |
void DbLoader::SetWorkDir | ( | const string & | workDir | ) |
Sets the working directory in which the generated files will be placed.
[in] | workDir | - indicates the working directory in which the files will be placed. |
None |
string DbLoader::_blockName [private] |
DbOutput& DbLoader::_dbOutput [private] |
string DbLoader::_INPUT_FILE [private] |
std::ofstream DbLoader::_log [private] |
const string DbLoader::_LOG_FILE = "SchemaMap.log" [static, private] |
SchemaMap& DbLoader::_schemaMapping [private] |
bool DbLoader::_verbose [private] |
string DbLoader::_workDir [private] |