本文整理汇总了C++中model::modules方法的典型用法代码示例。如果您正苦于以下问题:C++ model::modules方法的具体用法?C++ model::modules怎么用?C++ model::modules使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model
的用法示例。
在下文中一共展示了model::modules方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: i
boost::optional<qname> containing_module(model& m, const qname& qn) {
if (qn.model_name().empty() || qn.simple_name() == m.name().model_name()) {
BOOST_LOG_SEV(lg, debug) << "Type has no containing module: "
<< string_converter::convert(qn);
return boost::optional<qname>();
}
qname module_qn;
module_qn.model_name(qn.model_name());
if (qn.module_path().empty()) {
module_qn.simple_name(qn.model_name());
} else {
module_qn.simple_name(qn.module_path().back());
module_qn.module_path(qn.module_path());
module_qn.module_path().pop_back();
}
const auto i(m.modules().find(module_qn));
if (i != m.modules().end())
return module_qn;
BOOST_LOG_SEV(lg, debug) << "Could not find containing module: "
<< string_converter::convert(module_qn);
return boost::optional<qname>();;
}
示例2: read_module_path
void json_hydrator::read_module_path(const boost::property_tree::ptree& pt,
model& m, qname& qn) const {
const auto i(pt.find(module_path_key));
if (i == pt.not_found())
return;
for (auto j(i->second.begin()); j != i->second.end(); ++j) {
const auto module_name(j->second.get_value<std::string>());
qn.module_path().push_back(module_name);
qname module_qn;
module_qn.simple_name(module_name);
module_qn.model_name(model_name(m));
auto mp(qn.module_path());
mp.pop_back();
module_qn.module_path(mp);
const auto i(m.modules().find(module_qn));
if (i == m.modules().end()) {
module mod;
mod.name(module_qn);
mod.origin_type(m.origin_type());
mod.generation_type(m.generation_type());
m.modules().insert(std::make_pair(module_qn, mod));
}
}
}
示例3: post_process
void json_hydrator::post_process(model& m) const {
update_containing_module(m, m.objects());
update_containing_module(m, m.primitives());
update_containing_module(m, m.enumerations());
update_containing_module(m, m.concepts());
update_containing_module(m, m.modules());
}
示例4: expand_containing_module
void modules_expander::expand_containing_module(model& m) const {
update_containing_module(m, m.objects());
update_containing_module(m, m.primitives());
update_containing_module(m, m.enumerations());
update_containing_module(m, m.concepts());
update_containing_module(m, m.modules());
}
示例5: update_containing_module
inline void update_containing_module(model& m,
AssociativeContainerOfContainable& c) {
for (auto& pair : c) {
auto& s(pair.second);
s.containing_module(containing_module(m, s.name()));
if (!s.containing_module())
continue;
auto i(m.modules().find(*s.containing_module()));
if (i == m.modules().end()) {
const auto sn(s.containing_module()->simple());
BOOST_LOG_SEV(lg, error) << missing_module << sn;
BOOST_THROW_EXCEPTION(expansion_error(missing_module + sn));
}
BOOST_LOG_SEV(lg, debug) << "Adding type to module. Type: '"
<< s.name().qualified()
<< "' Module: '" << i->first.qualified();
i->second.members().push_back(s.name());
}
}
示例6: merge_model
void merger::merge_model(const model& m) {
BOOST_LOG_SEV(lg, info) << "Merging model: '"
<< m.name().qualified()
<< " modules: " << m.modules().size()
<< " concepts: " << m.concepts().size()
<< " primitives: " << m.primitives().size()
<< " enumerations: " << m.enumerations().size()
<< " objects: " << m.objects().size();
const auto mn(m.name().location().original_model_name());
for (const auto& c : m.concepts()) {
check_name(mn, c.first, c.second.name());
merged_model_.concepts().insert(c);
}
for (const auto& pair : m.primitives()) {
// FIXME: mega hack to handle primitive model.
const auto pmn(mn == hardware_model_name ? empty : mn);
check_name(pmn, pair.first, pair.second.name());
merged_model_.primitives().insert(pair);
}
for (const auto& pair : m.enumerations()) {
check_name(mn, pair.first, pair.second.name());
merged_model_.enumerations().insert(pair);
}
for (const auto& pair : m.objects()) {
check_name(mn, pair.first, pair.second.name());
merged_model_.objects().insert(pair);
}
for (const auto& pair : m.modules()) {
if (!pair.first.simple().empty())
check_name(mn, pair.first, pair.second.name());
merged_model_.modules().insert(pair);
}
}
示例7: add_target
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;
}
示例8: hash
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;
}