void generalization_indexer:: populate(const generalization_details& d, model& m) const { for (const auto& pair : d.leaves) { const auto& n(pair.first); auto i(m.objects().find(n)); if (i == m.objects().end()) { const auto qn(n.qualified()); BOOST_LOG_SEV(lg, error) << object_not_found << qn; BOOST_THROW_EXCEPTION(indexing_error(object_not_found + qn)); } const auto rt(relationship_types::leaves); i->second.relationships()[rt] = pair.second; i->second.relationships()[rt].sort(); const auto omn(m.name().location().original_model_name()); for (const auto& l : pair.second) { if (l.location().original_model_name() == omn) m.leaves().insert(l); } } for (const auto& pair : d.original_parents) { const auto& n(pair.first); auto i(m.objects().find(n)); if (i == m.objects().end()) { const auto qn(n.qualified()); BOOST_LOG_SEV(lg, error) << object_not_found << qn; BOOST_THROW_EXCEPTION(indexing_error(object_not_found + qn)); } auto& o(i->second); if (!o.is_child()) { // a bit of a hack, top-level types have themselves as the // original parent of the container just to make our life easier BOOST_LOG_SEV(lg, debug) << "Type has parents but is not a child: " << n.qualified(); continue; } const auto rt(relationship_types::original_parents); o.relationships()[rt] = pair.second; for (const auto& opn : pair.second) { const auto j(m.objects().find(opn)); if (j == m.objects().end()) { const auto qn(opn.qualified()); BOOST_LOG_SEV(lg, error) << object_not_found << qn; BOOST_THROW_EXCEPTION(indexing_error(object_not_found + qn)); } o.is_original_parent_visitable(j->second.is_visitable()); } } }
void merger::add_target(const model& target) { require_not_has_target(target.name().simple_name()); has_target_ = true; merged_model_.name(target.name()); merged_model_.documentation(target.documentation()); merged_model_.leaves(target.leaves()); merged_model_.modules(target.modules()); merged_model_.references(target.references()); add(target); BOOST_LOG_SEV(lg, debug) << "added target model: " << target.name().simple_name(); }
void merger::add_target(const model& target) { const auto qn(target.name().qualified()); require_not_has_target(qn); has_target_ = true; merged_model_.name(target.name()); merged_model_.documentation(target.documentation()); merged_model_.leaves(target.leaves()); merged_model_.modules(target.modules()); merged_model_.references(target.references()); merged_model_.extensions(target.extensions()); merged_model_.is_target(true); BOOST_LOG_SEV(lg, debug) << "added target model: " << qn; }
std::size_t model_hasher::hash(const model& v) { std::size_t seed(0); combine(seed, v.documentation()); combine(seed, v.extensions()); combine(seed, v.name()); combine(seed, v.generation_type()); combine(seed, v.origin_type()); combine(seed, hash_boost_optional_dogen_tack_name(v.containing_module())); combine(seed, hash_std_unordered_map_dogen_tack_name_dogen_tack_origin_types(v.references())); combine(seed, hash_std_unordered_set_dogen_tack_name(v.leaves())); combine(seed, hash_std_unordered_map_dogen_tack_name_dogen_tack_module(v.modules())); combine(seed, hash_std_unordered_map_dogen_tack_name_dogen_tack_concept(v.concepts())); combine(seed, hash_std_unordered_map_dogen_tack_name_dogen_tack_primitive(v.primitives())); combine(seed, hash_std_unordered_map_dogen_tack_name_dogen_tack_enumeration(v.enumerations())); combine(seed, hash_std_unordered_map_dogen_tack_name_dogen_tack_object(v.objects())); combine(seed, v.is_target()); combine(seed, v.has_generatable_types()); return seed; }