本文整理汇总了C++中intermediate_model::name方法的典型用法代码示例。如果您正苦于以下问题:C++ intermediate_model::name方法的具体用法?C++ intermediate_model::name怎么用?C++ intermediate_model::name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类intermediate_model
的用法示例。
在下文中一共展示了intermediate_model::name方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: dehydrate
std::string dehydrator::dehydrate(const intermediate_model& im) const {
std::ostringstream s;
formatters::utility_formatter uf(s);
using boost::algorithm::join;
const auto& l(im.name().location());
s << "{ ";
uf.insert_quoted("model_name");
s << " : ";
uf.insert_quoted(join(l.model_modules(), scope));
s << comma_space;
uf.insert_quoted("external_modules");
s << " : ";
uf.insert_quoted(join(l.external_modules(), scope));
const auto i(im.modules().find(im.name().id()));
if (i != im.modules().end()) {
const auto& root_module(i->second);
if (!root_module.documentation().empty()) {
s << comma_space;
uf.insert_quoted("documentation");
s << " : ";
uf.insert_quoted(tidy_up_string(root_module.documentation()));
}
}
dehydrate_annotations(im, im.name().id(), s);
if (has_elements(im)) {
s << comma_space;
uf.insert_quoted("elements");
s << ": [";
dehydrate_objects(im, s);
dehydrate_concepts(im, s);
dehydrate_modules(im, s);
dehydrate_enumerations(im, s);
dehydrate_exceptions(im, s);
s << " ]";
}
s << " }";
return s.str();
}
示例3: i
void generalization_indexer::
populate(const generalization_details& d, intermediate_model& m) const {
for (const auto& pair : d.leaves) {
const auto& n(pair.first);
auto i(m.objects().find(n.qualified()));
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);
o.leaves(pair.second);
o.leaves().sort();
for (const auto& leaf : pair.second) {
if (leaf.location().model_modules() ==
m.name().location().model_modules())
m.leaves().insert(leaf);
}
}
for (const auto& pair : d.root_parents) {
const auto& n(pair.first);
auto i(m.objects().find(n.qualified()));
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()) {
/* Top-level types have themselves as the original parent
* of the container just to make our life easier, so we
* have to ignore them here.
*/
BOOST_LOG_SEV(lg, debug) << "Type has parents but is not a child: "
<< n.qualified();
continue;
}
o.root_parents(pair.second);
for (const auto& opn : pair.second) {
const auto j(m.objects().find(opn.qualified()));
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_root_parent_visitable(j->second.is_visitable());
}
}
}
示例4: populate_properties_up_the_generalization_tree
void generalization_expander::populate_properties_up_the_generalization_tree(
const type_group& tg, const yarn::name& leaf,
intermediate_model& im, yarn::object& o) const {
/*
* Add the leaf to all nodes of the tree except for the leaf node
* itself.
*/
if (!o.is_leaf())
o.leaves().push_back(leaf);
/*
* If we do not have a parent we have reached the top of the
* generalisation tree.
*/
if (!o.parent()) {
/*
* If the leaf name belongs to the target model, add it to
* the model's list of leaves. Ignore non-target leaves.
*/
const auto& ll(leaf.location());
const auto& ml(im.name().location());
if (ll.model_modules() == ml.model_modules())
im.leaves().insert(leaf);
return;
}
const auto pid(o.parent()->id());
auto j(im.objects().find(pid));
if (j == im.objects().end()) {
BOOST_LOG_SEV(lg, error) << parent_not_found << pid;
BOOST_THROW_EXCEPTION(expansion_error(parent_not_found + pid));
}
auto& parent(j->second);
populate_properties_up_the_generalization_tree(tg, leaf, im, parent);
if (!parent.parent()) {
/*
* If our parent does not have a parent then it is our root
* parent.
*/
o.root_parent(parent.name());
} else {
/*
* On all other cases, inherit the root parent properties for
* our direct parent; these would have been populated from the
* root parent as per above.
*/
o.root_parent(parent.root_parent());
}
}
示例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, 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;
}
示例6: 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());
}
示例7: 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;
}
示例8: modules
void dehydrator::
dehydrate_modules(const intermediate_model& im, std::ostream& s) const {
/*
* Remove the root module.
*/
auto modules(to_map(im.modules()));
const auto i(modules.find(im.name().id()));
if (i != modules.end())
modules.erase(i);
using boost::algorithm::join;
formatters::utility_formatter uf(s);
bool output_comma(!im.objects().empty() || !im.concepts().empty());
for (const auto& pair : modules) {
if (output_comma)
s << comma_space;
const auto& o(pair.second);
s << " { ";
dehydrate_element(im, o, "module", s);
s << " }";
output_comma = true;
}
}
示例9: expand
void containment_expander::expand(intermediate_model& im) {
BOOST_LOG_SEV(lg, debug) << "Expanding containment for: " << im.name().id();
inject_global_module(im);
BOOST_LOG_SEV(lg, debug) << "Finished expanding containment.";
}