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

jobc::linkBuilder Class Reference

#include <linkBuilder.h>

Inheritance diagram for jobc::linkBuilder:

xmli::Builder List of all members.

Public Member Functions

 linkBuilder (const char *tag)
void Build (const xmli::AttributeList &attr, const std::string &buffer)

Constructor & Destructor Documentation

linkBuilder::linkBuilder const char *  tag  ) 
 

Definition at line 22 of file linkBuilder.cxx.

00022 : xmli::Builder(tag) { }


Member Function Documentation

void linkBuilder::Build const xmli::AttributeList attr,
const std::string &  buffer
[virtual]
 

Builders must implement this method which constructs a C++ object from XML attributes

Parameters:
attr : The list of key/value pairs of XML attributes
buffer : The text appearing inside the XML tags
For example, this XML string:
        <beetle name="ringo" instrument="drums"> 
          Ringo is my favorite 
        </beetle>
        
is passed as two attributes name=ringo, and instrument=drums and with buffer='Ringo is my favorite'

Once C++ object is created, it should be placed on a xmli::Stack to be used by other pieces of code

See also:
xmli::Stack.h
For examples see
See also:
xmli::intBuilder.cxx

xmli::xmlfileBuilder.cxx

Implements xmli::Builder.

Definition at line 26 of file linkBuilder.cxx.

References xmli::ChString::Split().

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 }


The documentation for this class was generated from the following files:
Generated on Sun Nov 22 04:45:32 2009 for NOvA Offline by  doxygen 1.3.9.1