Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

linkBuilder.cxx

Go to the documentation of this file.
00001 
00002 // $Id: linkBuilder.cxx,v 1.1 2007/02/09 04:44:14 fmwk Exp $
00003 //
00005 //
00006 // messier@indiana.edu
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 // Create and instance to be used by the XML parser
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& /*attr*/, 
00027                         const std::string& buffer) 
00028 {
00029 //======================================================================
00030 // Handle the link tag.
00031 //
00032 // At the end of the tag, parse each of the files listed in "buffer"
00033 //======================================================================
00034   
00035   // Split the string in to sub fields and extra the values from each
00036   // sub-field
00037   std::vector<std::string> files;
00038   xmli::ChString::Split(buffer.c_str()," ,\n\t\r",files);
00039 
00040   // Parse each file
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     // if (ierr>=0) std::cout << "JCXML: Linked " << lib << std::endl;
00049     if (ierr<0) {
00050       std::cerr << "jobc/xml: Failed to link " << lib << std::endl;
00051       iexit = true;
00052     }
00053   }
00054   // Do not continue with jobs that failed to link
00055   if (iexit == true) {
00056     std::cerr << "Failed to link libraries." << std::endl;
00057     exit(1);
00058   }
00059 }

Generated on Wed Oct 15 02:35:25 2008 for NOvA Offline by  doxygen 1.3.9.1