Alida-C++ 0.1

dataio/ALDDataIOManagerCmdline.cc

Go to the documentation of this file.
00001 /*
00002  * This file is part of the Alida-C++ library, an
00003  *
00004  * Advanced Library for Integrated Development of Data Analysis Applications.
00005  *
00006  * Copyright (C) 2012 - @YEAR@
00007  *
00008  * This program is free software: you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation, either version 3 of the License, or
00011  * (at your option) any later version.
00012  *
00013  * This program is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00020  *
00021  * Fore more information on Alida, visit
00022  *
00023  *    http://www.informatik.uni-halle.de/alida/
00024  *
00025  */
00026 
00027 /*
00028  * Most recent change(s):
00029  *
00030  * $Rev: 88 $
00031  * $Date: 2012-03-11 09:27:54 +0100 (So, 11 Mrz 2012) $
00032  * $Author: posch $
00033  *
00034  */
00035 
00036 #include <dlfcn.h>
00037 #include <math.h>
00038 #include <stdio.h>
00039 
00040 #include <fstream>
00041 #include <iostream>
00042 #include <string>
00043 
00044 #include "dataio/ALDDataIOManagerCmdline.h"
00045 #include "dataio/provider/cmdline/ALDDataIOCmdline.h"
00046 
00047 using namespace std;
00048 
00049 using namespace Alida;
00050 
00063 void* Alida::_ALDDataIOManagerCmdline::readData(string input, string type)
00064 {
00065     cout << "Reading " << type << "-data from string " << input << endl;
00066     ALDDataIOCmdline* provObjCmd;
00067     if (this->registrationTable == NULL)
00068         cout << "Table is null" << endl;
00069     if (this->registrationTable->find(type) == this->registrationTable->end()) {
00070         cerr << "Generate provider - no prototype found!" << endl;
00071         return NULL;
00072     }
00073     ALDDataIO* provObj = (*(this->registrationTable))[type];
00074     provObjCmd = dynamic_cast<ALDDataIOCmdline*>(provObj);
00075     if (provObjCmd == NULL)
00076         cout << "Object is null!" << endl;
00077     return provObjCmd->readData(input, type);
00078 }
00079 
00091 string
00092 Alida::_ALDDataIOManagerCmdline::writeData(string input,string type,void *data)
00093 {
00094     ALDDataIOCmdline* provObjCmd;
00095     if (this->registrationTable == NULL)
00096         cout << "Table is null" << endl;
00097     if (this->registrationTable->find(type) == this->registrationTable->end()) {
00098         cerr << "Generate provider - no prototype found!" << endl;
00099         return string();
00100     }
00101     ALDDataIO* provObj = (*(this->registrationTable))[type];
00102     provObjCmd = dynamic_cast<ALDDataIOCmdline*>(provObj);
00103     if (provObjCmd == NULL)
00104         cout << "Object is null!" << endl;
00105     return provObjCmd->writeData(input, type, data);
00106 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines