degate  0.1.2
Public Member Functions | Private Member Functions | Private Attributes
degate::RCVBlacklistImporter Class Reference

The RCVBlacklistImporter imports a list of RC violations, which should be ignored. More...

#include <RCVBlacklistImporter.h>

Inheritance diagram for degate::RCVBlacklistImporter:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 RCVBlacklistImporter (LogicModel_shptr lmodel)
 ~RCVBlacklistImporter ()
void import_into (std::string const &filename, RCBase::container_type &blacklist)

Private Member Functions

void parse_list (const xmlpp::Element *const element, RCBase::container_type &blacklist)

Private Attributes

LogicModel_shptr _lmodel

Detailed Description

The RCVBlacklistImporter imports a list of RC violations, which should be ignored.

Definition at line 37 of file RCVBlacklistImporter.h.


Constructor & Destructor Documentation

Definition at line 44 of file RCVBlacklistImporter.h.

: _lmodel(lmodel) {}

Definition at line 45 of file RCVBlacklistImporter.h.

{}

Member Function Documentation

void RCVBlacklistImporter::import_into ( std::string const &  filename,
RCBase::container_type blacklist 
)

Definition at line 42 of file RCVBlacklistImporter.cc.

References debug(), degate::get_basedir(), RET_IS_NOT_OK, and TM.

Referenced by degate::ProjectImporter::import_all().

                                                                    {

  if(RET_IS_NOT_OK(check_file(filename))) {
    debug(TM, "Problem: file %s not found.", filename.c_str());
    throw InvalidPathException("Can't load gate library from file.");
  }
  
  std::string directory = get_basedir(filename);

  try {

    xmlpp::DomParser parser;
    parser.set_substitute_entities(); // We just want the text to be resolved/unescaped automatically.

    parser.parse_file(filename);
    assert(parser == true);

    const xmlpp::Document * doc = parser.get_document();
    assert(doc != NULL);

    const xmlpp::Element * root_elem = doc->get_root_node(); // deleted by DomParser
    assert(root_elem != NULL);

    parse_list(root_elem, blacklist);

  }
  catch(const std::exception& ex) {
    std::cout << "Exception caught: " << ex.what() << std::endl;
    throw;
  }



}

Here is the call graph for this function:

Here is the caller graph for this function:

void RCVBlacklistImporter::parse_list ( const xmlpp::Element *const  element,
RCBase::container_type blacklist 
) [private]

Definition at line 79 of file RCVBlacklistImporter.cc.

References degate::RCVContainer::push_back().

                                                                        {

  const xmlpp::Node::NodeList rcv_list = elem->get_children("rc-violation");
  for(xmlpp::Node::NodeList::const_iterator iter = rcv_list.begin();
      iter != rcv_list.end(); ++iter) {

    if(const xmlpp::Element* e = dynamic_cast<const xmlpp::Element*>(*iter)) {

      object_id_t object_id = parse_number<object_id_t>(e, "object-id");

      const Glib::ustring rcv_class(e->get_attribute_value("rc-violation-class"));
      const Glib::ustring description(e->get_attribute_value("description"));
      const Glib::ustring severity(e->get_attribute_value("severity"));

      RCViolation_shptr rcv(new RCViolation(_lmodel->get_object(object_id),
                                            description,
                                            rcv_class,
                                            RCViolation::get_severity_from_string(severity)));
      
      blacklist.push_back(rcv);
    }
  }
}

Here is the call graph for this function:


Member Data Documentation

Definition at line 41 of file RCVBlacklistImporter.h.


The documentation for this class was generated from the following files: