@@ -2444,6 +2444,7 @@ void Conventions::fromXML(XMLNode* node) {
24442444 if (convention) {
24452445 try {
24462446 id = XMLUtils::getChildValue (child, " Id" , true );
2447+ DLOG (" Building Convention " << id);
24472448 convention->fromXML (child);
24482449 add (convention);
24492450 } catch (const std::exception& e) {
@@ -2453,6 +2454,7 @@ void Conventions::fromXML(XMLNode* node) {
24532454 } else {
24542455 try {
24552456 id = XMLUtils::getChildValue (child, " Id" , true );
2457+ DLOG (" Reading Convention " << id);
24562458 unparsed_[id] = std::make_pair (type, XMLUtils::toString (child));
24572459 } catch (const std::exception& e) {
24582460 WLOG (" Exception during retrieval of convention "
@@ -2474,7 +2476,7 @@ XMLNode* Conventions::toXML(XMLDocument& doc) {
24742476 return conventionsNode;
24752477}
24762478
2477- void Conventions::clear () {
2479+ void Conventions::clear () const {
24782480 boost::unique_lock<boost::shared_mutex> lock (mutex_);
24792481 data_.clear ();
24802482}
@@ -2511,15 +2513,16 @@ boost::shared_ptr<Convention> Conventions::get(const string& id) const {
25112513 return it->second ;
25122514 }
25132515
2514- boost::unique_lock<boost::shared_mutex> lock (mutex_);
2515-
25162516 std::string type, unparsed;
2517- if (auto it = unparsed_.find (id); it != unparsed_.end ()) {
2518- std::tie (type, unparsed) = it->second ;
2519- unparsed_.erase (id);
2520- } else if (auto it = unparsed_.find (flip (id)); it != unparsed_.end ()) {
2521- std::tie (type, unparsed) = it->second ;
2522- unparsed_.erase (flip (id));
2517+ {
2518+ boost::unique_lock<boost::shared_mutex> lock (mutex_);
2519+ if (auto it = unparsed_.find (id); it != unparsed_.end ()) {
2520+ std::tie (type, unparsed) = it->second ;
2521+ unparsed_.erase (id);
2522+ } else if (auto it = unparsed_.find (flip (id)); it != unparsed_.end ()) {
2523+ std::tie (type, unparsed) = it->second ;
2524+ unparsed_.erase (flip (id));
2525+ }
25232526 }
25242527
25252528 if (unparsed.empty ()) {
@@ -2574,9 +2577,9 @@ boost::shared_ptr<Convention> Conventions::get(const string& id) const {
25742577 }
25752578
25762579 try {
2577- DLOG (" Loading Convention " << id);
2580+ DLOG (" Building Convention " << id);
25782581 convention->fromXMLString (unparsed);
2579- addInternal (convention);
2582+ add (convention);
25802583 } catch (exception& e) {
25812584 QL_FAIL (" Required convention '" << id << " ' could not be built: " << e.what ());
25822585 }
@@ -2639,12 +2642,8 @@ bool Conventions::has(const std::string& id, const Convention::Type& type) const
26392642 return get (id, type).first ;
26402643}
26412644
2642- void Conventions::add (const boost::shared_ptr<Convention>& convention) {
2645+ void Conventions::add (const boost::shared_ptr<Convention>& convention) const {
26432646 boost::unique_lock<boost::shared_mutex> lock (mutex_);
2644- addInternal (convention);
2645- }
2646-
2647- void Conventions::addInternal (const boost::shared_ptr<Convention>& convention) const {
26482647 const string& id = convention->id ();
26492648 QL_REQUIRE (data_.find (id) == data_.end (), " Convention already exists for id " << id);
26502649 data_[id] = convention;
0 commit comments