00001
00002
00003
00004
00005
00006 #include "QueryTranslator.h"
00007
00008 using namespace LcgInfo;
00009 using namespace std;
00010
00011
00012
00013 QueryTranslator::QueryTranslator(){
00014 mMap=new LcgConfigBuffer::ConfigBuffer();
00015 cout << "WARNING!!: No mapfile provided!";
00016 cout << "Using \"./mappingGlueRGMA\" as default one" << endl;
00017 try{
00018 mMap->populate_from_config("./mappingGlueRGMA");
00019 }catch(LcgConfigBuffer::CBException& e){
00020 string msg="No valid mapping file. Aborting.";
00021 msg += "\nUnderlying LcgConfigBuffer::CBException message: " + e.what() + " +line: ";
00022 msg += int2str(e.get_line()) + " +file: " + e.get_file();
00023 throw QueryTranslationException(msg,__FILE__,__LINE__);
00024 }
00025 mTRowT=new TableRowTranslator(*mMap);
00026 mOurMap=true;
00027 }
00028
00029 QueryTranslator::QueryTranslator(string const & pMapFile){
00030 mMap=new LcgConfigBuffer::ConfigBuffer();
00031 try{
00032 mMap->populate_from_config(pMapFile);
00033 }catch(LcgConfigBuffer::CBException& e){
00034 string msg="No valid mapping file. Aborting.";
00035 msg += "\nUnderlying LcgConfigBuffer::CBException message: " + e.what() + " +line: ";
00036 msg += int2str(e.get_line()) + " +file: " + e.get_file();
00037 throw QueryTranslationException(msg,__FILE__,__LINE__);
00038 }
00039 mTRowT=new TableRowTranslator(*mMap);
00040 mOurMap=true;
00041 }
00042
00043 QueryTranslator::QueryTranslator(LcgConfigBuffer::ConfigBuffer & pMap):mMap(&pMap){
00044 mTRowT=new TableRowTranslator(*mMap);
00045 mOurMap=false;
00046 }
00047
00048 QueryTranslator::~QueryTranslator(){
00049 if(mOurMap){
00050 delete mMap;
00051 mMap=0;
00052 }
00053 delete mTRowT;
00054 mTRowT=0;
00055 }
00056