|
degate 0.1.1
|
The RCVBlacklistImporter imports a list of RC violations, which should be ignored. More...
#include <RCVBlacklistImporter.h>

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 |
The RCVBlacklistImporter imports a list of RC violations, which should be ignored.
Definition at line 37 of file RCVBlacklistImporter.h.
| degate::RCVBlacklistImporter::RCVBlacklistImporter | ( | LogicModel_shptr | lmodel | ) | [inline] |
Definition at line 44 of file RCVBlacklistImporter.h.
: _lmodel(lmodel) {}
| degate::RCVBlacklistImporter::~RCVBlacklistImporter | ( | ) | [inline] |
Definition at line 45 of file RCVBlacklistImporter.h.
{}
| 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;
}
}


| 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);
}
}
}

Definition at line 41 of file RCVBlacklistImporter.h.
1.7.4