本文整理汇总了C++中intermediate_model::visitors方法的典型用法代码示例。如果您正苦于以下问题:C++ intermediate_model::visitors方法的具体用法?C++ intermediate_model::visitors怎么用?C++ intermediate_model::visitors使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类intermediate_model
的用法示例。
在下文中一共展示了intermediate_model::visitors方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: inject_global_module
void containment_expander::inject_global_module(intermediate_model& im) {
BOOST_LOG_SEV(lg, debug) << "Injecting global module for: "
<< im.name().id();
const auto gm(create_global_module(im.origin_type()));
const auto gmn(gm.name());
const auto i(im.modules().find(gmn.id()));
if (i != im.modules().end()) {
const auto id(im.name().id());
BOOST_LOG_SEV(lg, error) << model_already_has_global_module << id;
BOOST_THROW_EXCEPTION(
injection_error(model_already_has_global_module + id));
}
im.modules().insert(std::make_pair(gmn.id(), gm));
add_containing_module_to_non_contained_entities(gmn, im.modules());
add_containing_module_to_non_contained_entities(gmn, im.concepts());
add_containing_module_to_non_contained_entities(gmn, im.primitives());
add_containing_module_to_non_contained_entities(gmn, im.enumerations());
add_containing_module_to_non_contained_entities(gmn, im.objects());
add_containing_module_to_non_contained_entities(gmn, im.exceptions());
add_containing_module_to_non_contained_entities(gmn, im.visitors());
BOOST_LOG_SEV(lg, debug) << "Done injecting global module";
}
示例2: hash
std::size_t intermediate_model_hasher::hash(const intermediate_model& v) {
std::size_t seed(0);
combine(seed, v.name());
combine(seed, v.origin_type());
combine(seed, v.original_model_name());
combine(seed, v.generation_type());
combine(seed, hash_std_unordered_map_dogen_yarn_name_dogen_yarn_origin_types(v.references()));
combine(seed, hash_std_unordered_set_dogen_yarn_name(v.leaves()));
combine(seed, hash_std_unordered_map_std_string_dogen_yarn_module(v.modules()));
combine(seed, hash_std_unordered_map_std_string_dogen_yarn_concept(v.concepts()));
combine(seed, hash_std_unordered_map_std_string_dogen_yarn_primitive(v.primitives()));
combine(seed, hash_std_unordered_map_std_string_dogen_yarn_enumeration(v.enumerations()));
combine(seed, hash_std_unordered_map_std_string_dogen_yarn_object(v.objects()));
combine(seed, hash_std_unordered_map_std_string_dogen_yarn_exception(v.exceptions()));
combine(seed, hash_std_unordered_map_std_string_dogen_yarn_visitor(v.visitors()));
combine(seed, v.is_target());
combine(seed, v.has_generatable_types());
return seed;
}
示例3: inject_global_module
void injector::inject_global_module(intermediate_model& m) {
const auto gm(create_global_module());
const auto gmn(gm.name());
const auto i(m.modules().find(gmn.qualified()));
if (i != m.modules().end()) {
const auto qn(m.name().qualified());
BOOST_LOG_SEV(lg, error) << model_already_has_global_module << qn;
BOOST_THROW_EXCEPTION(injection_error(
model_already_has_global_module + qn));
}
m.modules().insert(std::make_pair(gmn.qualified(), gm));
add_containing_module_to_non_contained_entities(gmn, m.modules());
add_containing_module_to_non_contained_entities(gmn, m.concepts());
add_containing_module_to_non_contained_entities(gmn, m.primitives());
add_containing_module_to_non_contained_entities(gmn, m.enumerations());
add_containing_module_to_non_contained_entities(gmn, m.objects());
add_containing_module_to_non_contained_entities(gmn, m.exceptions());
add_containing_module_to_non_contained_entities(gmn, m.visitors());
}
示例4: elements_traversal
inline void elements_traversal(intermediate_model& m, TraversalVisitor& v) {
for (auto& pair : m.modules())
v(pair.second);
for (auto& pair : m.concepts())
v(pair.second);
for (auto& pair : m.primitives())
v(pair.second);
for (auto& pair : m.enumerations())
v(pair.second);
for (auto& pair : m.objects())
v(pair.second);
for (auto& pair : m.exceptions())
v(pair.second);
for (auto& pair : m.visitors())
v(pair.second);
}
示例5: hash
std::size_t intermediate_model_hasher::hash(const intermediate_model& v) {
std::size_t seed(0);
combine(seed, v.name());
combine(seed, v.origin_type());
combine(seed, hash_std_unordered_map_dogen_yarn_name_dogen_yarn_origin_types(v.references()));
combine(seed, hash_std_unordered_set_dogen_yarn_name(v.leaves()));
combine(seed, hash_std_unordered_map_std_string_dogen_yarn_module(v.modules()));
combine(seed, hash_std_unordered_map_std_string_dogen_yarn_concept(v.concepts()));
combine(seed, hash_std_unordered_map_std_string_dogen_yarn_primitive(v.primitives()));
combine(seed, hash_std_unordered_map_std_string_dogen_yarn_enumeration(v.enumerations()));
combine(seed, hash_std_unordered_map_std_string_dogen_yarn_object(v.objects()));
combine(seed, hash_std_unordered_map_std_string_dogen_yarn_exception(v.exceptions()));
combine(seed, hash_std_unordered_map_std_string_dogen_yarn_visitor(v.visitors()));
combine(seed, hash_std_unordered_map_std_string_boost_shared_ptr_dogen_yarn_element(v.injected_elements()));
combine(seed, v.has_generatable_types());
combine(seed, v.indices());
combine(seed, v.root_module());
combine(seed, v.language());
return seed;
}
示例6: inject_visitors
void injector::inject_visitors(intermediate_model& m) {
BOOST_LOG_SEV(lg, debug) << "Injecting visitors.";
std::list<visitor> visitors;
for (auto& pair : m.objects()) {
auto& o(pair.second);
if (!o.is_visitable())
continue;
if (o.leaves().empty()) {
const auto qn(o.name().qualified());
BOOST_LOG_SEV(lg, error) << zero_leaves << qn;
BOOST_THROW_EXCEPTION(injection_error(zero_leaves + qn));
}
const auto v(create_visitor(o, o.leaves()));
inject_visitable_by(o, o.leaves(), v.name(), m);
visitors.push_back(v);
}
for (const auto v : visitors) {
BOOST_LOG_SEV(lg, debug) << "Adding visitor: "
<< v.name().qualified();
const auto pair(std::make_pair(v.name().qualified(), v));
const auto i(m.visitors().insert(pair));
if (!i.second) {
const auto qn(v.name().qualified());
BOOST_LOG_SEV(lg, error) << duplicate_name << qn;
BOOST_THROW_EXCEPTION(injection_error(duplicate_name + qn));
}
}
BOOST_LOG_SEV(lg, debug) << "Done injecting visitors.";
}