DbLoader Class Reference

The controller of CIF to DB data conversion process. More...

#include <CifSchemaMap.h>

Collaboration diagram for DbLoader:

Collaboration graph
[legend]
List of all members.

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"

Detailed Description

The controller of CIF to DB data conversion process.

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.


Member Enumeration Documentation

enum DbLoader::eConvOpt

Enumerator:
eDATA_ONLY 
eDATA_WITH_SCRIPTS 
eSCRIPTS_ONLY 


Constructor & Destructor Documentation

DbLoader::DbLoader ( SchemaMap &  schemaMapping,
DbOutput dbOutput,
bool  verbose = false,
const string &  workDir = std::string() 
)

Constructs a CIF to DB controller object.

Parameters:
[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.
Returns:
Not applicable
Precondition:
None
Postcondition:
None
Exceptions:
 None

DbLoader::~DbLoader (  )  [virtual]

Destructs a CIF to DB controller object.

Parameters:
 Not applicable
Returns:
Not applicable
Precondition:
None
Postcondition:
None
Exceptions:
 None


Member Function Documentation

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.

Parameters:
[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.
Returns:
None
Precondition:
None
Postcondition:
None
Exceptions:
 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.

Parameters:
[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.
Returns:
None
Precondition:
None
Postcondition:
None
Exceptions:
 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.

Parameters:
[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.
Returns:
None
Precondition:
None
Postcondition:
None
Exceptions:
 None

void DbLoader::SetWorkDir ( const string &  workDir  ) 

Sets the working directory in which the generated files will be placed.

Parameters:
[in] workDir - indicates the working directory in which the files will be placed.
Returns:
None
Precondition:
None
Postcondition:
None
Exceptions:
 None


Member Data Documentation

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]


The documentation for this class was generated from the following files:
Generated on Thu Oct 6 10:15:54 2011 for db-loader-v4.1.0 by  doxygen 1.4.7