Commit 384add1d authored by Tarun Prabhu's avatar Tarun Prabhu

Made changes so that assign builds correctly when Xerces is not installed....

Made changes so that assign builds correctly when Xerces is not installed. Tested this on ops and it seems to be ok.
parent 76b1bc00
......@@ -5,10 +5,12 @@
*/
/*
* XML Parser for RSpec ptop files
* Implements the annotate methods which are independent of the type of file being annotated.
*/
static const char rcsid[] = "$Id: annotate.cc,v 1.1.2.1 2009-04-29 23:47:29 tarunp Exp $";
static const char rcsid[] = "$Id: annotate.cc,v 1.1.2.2 2009-05-19 20:10:14 tarunp Exp $";
#ifdef WITH_XML
#include "annotate.h"
......@@ -48,3 +50,5 @@ void annotate::write_annotated_file (const char* filename)
// Release the memory
writer->release();
}
#endif
......@@ -5,9 +5,13 @@
*/
/*
* XML Parser for RSpec ptop files
* Base class for the annotater.
*/
/* This is ugly, but we only really need this file if we are building with XML support */
#ifdef WITH_XML
#ifndef __ANNOTATE_H
#define __ANNOTATE_H
......@@ -43,4 +47,6 @@ class annotate
void write_annotated_file(const char* filename);
};
#endif
#endif // for __ANNOTATE_H
#endif // for WITH_XML
......@@ -4,7 +4,9 @@
* All rights reserved.
*/
static const char rcsid[] = "$Id: annotate_rspec.cc,v 1.1.2.2 2009-04-29 23:47:30 tarunp Exp $";
static const char rcsid[] = "$Id: annotate_rspec.cc,v 1.1.2.3 2009-05-19 20:10:15 tarunp Exp $";
#ifdef WITH_XML
#include "annotate.h"
#include "annotate_rspec.h"
......@@ -23,8 +25,6 @@ static const char rcsid[] = "$Id: annotate_rspec.cc,v 1.1.2.2 2009-04-29 23:47:3
#define XMLDEBUG(x) (cerr << x);
#ifdef WITH_XML
extern DOMDocument* doc;
extern DOMElement* request_root;
extern map<string, DOMElement*>* advertisement_elements;
......
/*
* EMULAB-COPYRIGHT
* Copyright (c) 2008 University of Utah and the Flux Group.
* All rights reserved.
*/
/*
* Base class for the annotater.
*/
/* This is ugly, but we only really need this file if we are building with XML support */
#ifdef WITH_XML
#ifndef __ANNOTATE_RSPEC_H
#define __ANNOTATE_RSPEC_H
......@@ -42,4 +56,6 @@ class annotate_rspec : public annotate
void annotate_rspec::copy_component_spec(const xercesc::DOMElement* src, xercesc::DOMElement* dst);
};
#endif
#endif //for __ANNOTATE_RSPEC_H
#endif // for WITH_XML
......@@ -4,7 +4,9 @@
* All rights reserved.
*/
static const char rcsid[] = "$Id: annotate_vtop.cc,v 1.1.2.1 2009-04-29 23:47:30 tarunp Exp $";
static const char rcsid[] = "$Id: annotate_vtop.cc,v 1.1.2.2 2009-05-19 20:10:15 tarunp Exp $";
#ifdef WITH_XML
#include "annotate.h"
#include "annotate_vtop.h"
......@@ -23,8 +25,6 @@ static const char rcsid[] = "$Id: annotate_vtop.cc,v 1.1.2.1 2009-04-29 23:47:30
#define XMLDEBUG(x) (cerr << x);
#ifdef WITH_XML
extern DOMDocument* vtop_xml_document;
extern DOMElement* root;
extern map<string, DOMElement*>* ptop_elements;
......
/*
* EMULAB-COPYRIGHT
* Copyright (c) 2008 University of Utah and the Flux Group.
* All rights reserved.
*/
/*
* Base class for the annotater.
*/
/* This is ugly, but we only really need this file if we are building with XML support */
#ifdef WITH_XML
#ifndef __ANNOTATE_VTOP_H
#define __ANNOTATE_VTOP_H
......@@ -42,4 +56,6 @@ class annotate_vtop : public annotate
void set_component_hop_interface (xercesc::DOMElement* hop_interface, const xercesc::DOMElement* physical_interface);
};
#endif
#endif // for __ANNOTATE_VTOP_H
#endif // for WITH_XML
......@@ -839,7 +839,6 @@ int main(int argc,char **argv) {
char* ptopFilename = "";
char* vtopFilename = "";
cout << argc << " arguments provided" << endl;
while ((ch = getopt(argc,argv,"s:v:l:t:rpPTdH:oguc:nx:X:y:Y:q:w:F")) != -1) {
switch (ch) {
case 's':
......
......@@ -8,7 +8,9 @@
* XML Parser for RSpec ptop files
*/
static const char rcsid[] = "$Id: parse_advertisement_rspec.cc,v 1.1.2.3 2009-05-12 22:19:03 tarunp Exp $";
static const char rcsid[] = "$Id: parse_advertisement_rspec.cc,v 1.1.2.4 2009-05-19 20:10:15 tarunp Exp $";
#ifdef WITH_XML
#include "parse_advertisement_rspec.h"
#include "xmlhelpers.h"
......@@ -638,3 +640,5 @@ bool populate_links_rspec(DOMElement *root, tb_pgraph &pg, tb_sgraph &sg) {
}
return is_ok;
}
#endif
......@@ -8,6 +8,8 @@
* Parsing for the (experimental) ptop XML format
*/
#ifdef WITH_XML
#ifndef __PARSE_ADVERTISEMENT_RSPEC_H
#define __PARSE_ADVERTISEMENT_RSPEC_H
......@@ -26,4 +28,6 @@ XERCES_CPP_NAMESPACE_USE
int parse_ptop_rspec(tb_pgraph &PG, tb_sgraph &SG, char *filename);
#endif
#endif // for __PARSE_ADVERTISEMENT_RSPEC_H
#endif // for WITH_XML
......@@ -4,7 +4,9 @@
* All rights reserved.
*/
static const char rcsid[] = "$Id: parse_error_handler.cc,v 1.1.2.1 2009-04-03 20:58:04 duerig Exp $";
static const char rcsid[] = "$Id: parse_error_handler.cc,v 1.1.2.2 2009-05-19 20:10:15 tarunp Exp $";
#ifdef WITH_XML
#include "parse_error_handler.h"
......@@ -23,3 +25,5 @@ void ParseErrorHandler::fatalError(const SAXParseException& toCatch) {
<< "\n Message: " << XStr(toCatch.getMessage()) << XERCES_STD_QUALIFIER endl;
this->hadError = true;
}
#endif
......@@ -4,6 +4,8 @@
* All rights reserved.
*/
#ifdef WITH_XML
#ifndef __PARSE_ERROR_HANDLER_H
#define __PARSE_ERROR_HANDLER_H
......@@ -54,4 +56,6 @@ private:
};
#endif
#endif // for __PARSE_ERROR_HANDLER_H
#endif // for WITH_XML
......@@ -8,7 +8,9 @@
* XML Parser for policy files
*/
static const char rcsid[] = "$Id: parse_policy_xml.cc,v 1.1.2.1 2008-10-27 19:51:47 tarunp Exp $";
static const char rcsid[] = "$Id: parse_policy_xml.cc,v 1.1.2.2 2009-05-19 20:10:15 tarunp Exp $";
#ifdef WITH_XML
#include "parse_policy_xml.h"
#include "xmlhelpers.h"
......@@ -165,3 +167,5 @@ bool populate_desire_limits(DOMElement *root)
}
return is_ok;
}
#endif
......@@ -8,6 +8,8 @@
* Parsing for the (experimental) policy XML format
*/
#ifdef WITH_XML
#ifndef __PARSE_POLICY_XML_H
#define __PARSE_POLICY_XML_H
......@@ -25,4 +27,6 @@ XERCES_CPP_NAMESPACE_USE
int parse_policy_xml(char *filename);
#endif
#endif // for __PARSE_POLICY_XML
#endif // for WITH_XML
......@@ -8,7 +8,9 @@
* XML Parser for ptop files
*/
static const char rcsid[] = "$Id: parse_ptop_xml.cc,v 1.3.8.13 2009-05-05 18:05:33 tarunp Exp $";
static const char rcsid[] = "$Id: parse_ptop_xml.cc,v 1.3.8.14 2009-05-19 20:10:15 tarunp Exp $";
#ifdef WITH_XML
#include "parse_ptop_xml.h"
#include "xmlhelpers.h"
......@@ -475,3 +477,5 @@ bool populate_links(DOMElement *root, tb_pgraph &pg, tb_sgraph &sg) {
}
return !errors;
}
#endif
......@@ -8,6 +8,8 @@
* Parsing for the (experimental) ptop XML format
*/
#ifdef WITH_XML
#ifndef __PARSE_PTOP_XML_H
#define __PARSE_PTOP_XML_H
......@@ -25,4 +27,6 @@ XERCES_CPP_NAMESPACE_USE
int parse_ptop_xml(tb_pgraph &PG, tb_sgraph &SG, char *filename);
#endif
#endif // for __PARSE_PTOP_XML_H
#endif // for WITH_XML
......@@ -8,7 +8,9 @@
* XML Parser for RSpec ptop files
*/
static const char rcsid[] = "$Id: parse_request_rspec.cc,v 1.1.2.3 2009-05-12 22:19:03 tarunp Exp $";
static const char rcsid[] = "$Id: parse_request_rspec.cc,v 1.1.2.4 2009-05-19 20:10:15 tarunp Exp $";
#ifdef WITH_XML
#include "parse_request_rspec.h"
#include "xmlhelpers.h"
......@@ -589,58 +591,4 @@ bool populate_links_rspec(DOMElement *root, tb_vgraph &vg) {
return is_ok;
}
// bool populate_vclasses_rspec (DOMElement *root, tb_vgraph &vg)
// {
// bool is_ok = true;
//
// DOMNodeList *vclass_elements = root->getElementsByTagName(XStr("vclass").x());
// int vclassCount = vclass_elements->getLength();
// //XMLDEBUG("Found " << vclassCount << " vclasses in vtop" << endl);
//
// for (size_t i = 0; i < vclassCount; i++)
// {
// DOMNode *vclass = vclass_elements->item(i);
//
// // This should not be able to fail, due to the fact that all elements in
// // this list came from the getElementsByTagName() call
// DOMElement *elt = dynamic_cast<DOMElement*>(vclass);
//
// XStr vclass_name (elt->getAttribute(XStr("name").x()));
// const char *str_vclass_name = vclass_name.c();
//
// tb_vclass *v = NULL;
// /*
// * XXX: Have not dealt with the case when the hard tag is present.
// * Will have to do this before we can use this correctly
// */
// if (hasChildTag (elt, "hard"))
// {
// // Deal with it here
// }
// else if (hasChildTag (elt, "soft"))
// {
// XStr vclass_weight (getChildValue(elt, "weight"));
// v = new tb_vclass(vclass_name.f(),vclass_weight.d());
// if (v == NULL)
// {
// //cerr << "Could not create vclass: " << vclass_name << endl;
// is_ok = false;
// continue;
// }
// vclass_map[str_vclass_name] = v;
// }
//
// /* Get all the physical types for the vclass */
// DOMNodeList *phys_types = elt->getElementsByTagName(XStr("physical_type").x());
// for (int j = 0; j < phys_types->getLength(); j++)
// {
// DOMElement* phys_type = dynamic_cast<DOMElement*>(phys_types -> item(j));
// XStr phys_type_name (phys_type -> getFirstChild() -> getNodeValue());
// v->add_type(phys_type_name.f());
// vclasses[str_vclass_name].push_back(phys_type_name.f());
// }
// }
// return is_ok;
// }
#endif
......@@ -8,6 +8,8 @@
* Parsing for the (experimental) ptop XML format
*/
#ifdef WITH_XML
#ifndef __PARSE_REQUEST_RSPEC_H
#define __PARSE_REQUEST_RSPEC_H
......@@ -26,4 +28,6 @@ XERCES_CPP_NAMESPACE_USE
int parse_vtop_rspec(tb_vgraph &VG, char *filename);
#endif
#endif // for __PARSE_REQUEST_RSPEC_H
#endif // for WITH_XML
......@@ -4,7 +4,9 @@
* All rights reserved.
*/
static const char rcsid[] = "$Id: parse_vtop_xml.cc,v 1.1.2.6 2009-05-05 18:05:33 tarunp Exp $";
static const char rcsid[] = "$Id: parse_vtop_xml.cc,v 1.1.2.7 2009-05-19 20:10:15 tarunp Exp $";
#ifdef WITH_XML
#include "port.h"
......@@ -458,3 +460,5 @@ int bind_vtop_subnodes(tb_vgraph &vg) {
return errors;
}
#endif
......@@ -4,8 +4,10 @@
* All rights reserved.
*/
#ifndef __PARSE_TOP_XML_H
#define __PARSE_TOP_XML_H
#ifdef WITH_XML
#ifndef __PARSE_VTOP_XML_H
#define __PARSE_VTOP_XML_H
#include <xercesc/util/PlatformUtils.hpp>
......@@ -30,4 +32,6 @@ XERCES_CPP_NAMESPACE_USE
int parse_vtop_xml(tb_vgraph &VG, char* filename);
#endif
#endif // for __PARSE_VTOP_XML_H
#endif // for WITH_XML
......@@ -4,19 +4,20 @@
* All rights reserved.
*/
static const char rcsid[] = "$Id: solution.cc,v 1.12.8.5 2009-04-29 23:47:30 tarunp Exp $";
static const char rcsid[] = "$Id: solution.cc,v 1.12.8.6 2009-05-19 20:10:16 tarunp Exp $";
#include "solution.h"
#include "annotate_rspec.h"
#include "annotate_vtop.h"
#include "vclass.h"
#include <string>
#include <list>
#include <utility>
#include "xstr.h"
#ifdef WITH_XML
#include "annotate_rspec.h"
#include "annotate_vtop.h"
#include "xstr.h"
#endif
extern bool ptop_xml_input;
extern bool ptop_rspec_input;
......@@ -68,10 +69,10 @@ void print_solution(const solution &s) {
if (! s.is_assigned(*vit)) {
cout << "unassigned: " << vn->name << endl;
} else {
cout << vn->name << " " << get(pvertex_pmap,s.get_assignment(*vit))->name << endl;
#ifdef WITH_XML
const char* node_name = XStr(vn -> name).c();
const char* assigned_to = XStr (get(pvertex_pmap,s.get_assignment(*vit))->name).c() ;
cout << node_name << " " << assigned_to << endl;
#ifdef WITH_XML
if (both_inputs_rspec == true)
{
rspec_annotater->annotate_element(node_name, assigned_to);
......
......@@ -4,6 +4,8 @@
* All rights reserved.
*/
#ifdef WITH_XML
#include "xmlhelpers.h"
#include "xstr.h"
#include <string>
......@@ -228,3 +230,5 @@ bool hasComponentSpec (DOMElement* elt)
return true;
return false;
}
#endif
......@@ -8,6 +8,8 @@
* xmlhelpers.h - Classes and functions to make XML parsing a little easier
*/
#ifdef WITH_XML
#ifndef __XMLHELPERS_H
#define __XMLHELPERS_H
......@@ -117,4 +119,6 @@ interface_spec parse_interface_rspec_xml (const xercesc::DOMElement* element);
*/
bool hasComponentSpec (xercesc::DOMElement* elt);
#endif
#endif // for __XMLHELPERS_H
#endif // for WITH_XML
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment