annotate.h 1.43 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
/*
 * EMULAB-COPYRIGHT
 * Copyright (c) 2008 University of Utah and the Flux Group.
 * All rights reserved.
 */

/*
 * Base class for the annotater. 
 */

#ifdef WITH_XML

#ifndef __ANNOTATE_H

#define __ANNOTATE_H

#include <utility>
#include <string>
#include <list>
#include <map>

#include <xercesc/dom/DOM.hpp>

class annotate
{
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
 protected: 
  //xercesc::DOMDocument* doc;
  xercesc::DOMElement* virtual_root;
  std::map<std::string, xercesc::DOMElement*> *physical_elements;
  
 public:
  // Annotates nodes and direct links in the rspec
  virtual void annotate_element(const char* v_name, const char* p_name) = 0;
  
  // Annotates intraswitch and interswitch links in the rspec
  virtual void annotate_element(const char* v_name, 
				std::list<const char*>* links) = 0;
  
  // Creates a hop from a switch till the next end point. 
  // Adds the hop to the vlink and returns the hop element that was created
  virtual xercesc::DOMElement* 
    create_component_hop (const xercesc::DOMElement* plink, 
			  xercesc::DOMElement* vlink, 
			  int endpoint_interface, 
			  const xercesc::DOMElement* prev_component_hop) = 0;
  
  // Finds the next link in the path returned by assign
  virtual xercesc::DOMElement* 
    find_next_link_in_path (xercesc::DOMElement *prev, 
			    std::list<const char*>* links) = 0;
  
  // Writes the annotated xml to disk
  void write_annotated_file(const char* filename);
54 55 56 57 58
};

#endif // for __ANNOTATE_H

#endif // for WITH_XML