00001
00002
00003
00005
00006
00008 #include "JobControl/xml/linkBuilder.h"
00009 #include <vector>
00010 #include <iostream>
00011 #include "TSystem.h"
00012 #include "XMLInterface/xmli.h"
00013 #include "XMLInterface/Stack.h"
00014 #include "XMLInterface/ChString.h"
00015 using namespace jobc;
00016
00017
00018 static linkBuilder gs_link("link");
00019
00020
00021
00022 linkBuilder::linkBuilder(const char* tag) : xmli::Builder(tag) { }
00023
00024
00025
00026 void linkBuilder::Build(const xmli::AttributeList& ,
00027 const std::string& buffer)
00028 {
00029
00030
00031
00032
00033
00034
00035
00036
00037 std::vector<std::string> files;
00038 xmli::ChString::Split(buffer.c_str()," ,\n\t\r",files);
00039
00040
00041 bool iexit = false;
00042 int ierr = 0;
00043 std::vector<std::string>::iterator itr(files.begin());
00044 std::vector<std::string>::iterator itrEnd(files.end());
00045 for (; itr!=itrEnd; ++itr) {
00046 std::string lib = "lib"; lib += *itr; lib += ".so";
00047 ierr += gSystem->Load(lib.c_str());
00048
00049 if (ierr<0) {
00050 std::cerr << "jobc/xml: Failed to link " << lib << std::endl;
00051 iexit = true;
00052 }
00053 }
00054
00055 if (iexit == true) {
00056 std::cerr << "Failed to link libraries." << std::endl;
00057 exit(1);
00058 }
00059 }