本文整理汇总了C++中request::get_locality_id方法的典型用法代码示例。如果您正苦于以下问题:C++ request::get_locality_id方法的具体用法?C++ request::get_locality_id怎么用?C++ request::get_locality_id使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类request
的用法示例。
在下文中一共展示了request::get_locality_id方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: bind_prefix
response component_namespace::bind_prefix(
request const& req
, error_code& ec
)
{ // {{{ bind_prefix implementation
// parameters
std::string key = req.get_name();
boost::uint32_t prefix = req.get_locality_id();
mutex_type::scoped_lock l(mutex_);
component_id_table_type::left_map::iterator cit = component_ids_.left.find(key)
, cend = component_ids_.left.end();
// This is the first request, so we use the type counter, and then
// increment it.
if (component_ids_.left.find(key) == cend)
{
if (HPX_UNLIKELY(!util::insert_checked(component_ids_.left.insert(
std::make_pair(key, type_counter)), cit)))
{
l.unlock();
HPX_THROWS_IF(ec, lock_error
, "component_namespace::bind_prefix"
, "component id table insertion failed due to a locking "
"error or memory corruption")
return response();
}
// If the insertion succeeded, we need to increment the type
// counter.
++type_counter;
}
示例2: bind_prefix
response component_namespace::bind_prefix(
request const& req
, error_code& ec
)
{ // {{{ bind_prefix implementation
// parameters
std::string key = req.get_name();
boost::uint32_t prefix = req.get_locality_id();
std::unique_lock<mutex_type> l(mutex_);
component_id_table_type::left_map::iterator cit = component_ids_.left.find(key)
, cend = component_ids_.left.end();
// This is the first request, so we use the type counter, and then
// increment it.
if (component_ids_.left.find(key) == cend)
{
if (HPX_UNLIKELY(!util::insert_checked(component_ids_.left.insert(
std::make_pair(key, type_counter)), cit)))
{
l.unlock();
HPX_THROWS_IF(ec, lock_error
, "component_namespace::bind_prefix"
, "component id table insertion failed due to a locking "
"error or memory corruption");
return response();
}
// If the insertion succeeded, we need to increment the type
// counter.
++type_counter;
}
factory_table_type::iterator fit = factories_.find(cit->second)
, fend = factories_.end();
if (fit != fend)
{
prefixes_type& prefixes = fit->second;
prefixes_type::iterator pit = prefixes.find(prefix);
if (pit != prefixes.end())
{
// Duplicate type registration for this locality.
l.unlock();
HPX_THROWS_IF(ec, duplicate_component_id
, "component_namespace::bind_prefix"
, boost::str(boost::format(
"component id is already registered for the given "
"locality, key(%1%), prefix(%2%), ctype(%3%)")
% key % prefix % cit->second));
return response();
}
fit->second.insert(prefix);
// First registration for this locality, we still return no_success to
// convey the fact that another locality already registered this
// component type.
LAGAS_(info) << (boost::format(
"component_namespace::bind_prefix, key(%1%), prefix(%2%), "
"ctype(%3%), response(no_success)")
% key % prefix % cit->second);
if (&ec != &throws)
ec = make_success_code();
return response(component_ns_bind_prefix
, cit->second
, no_success);
}
// Instead of creating a temporary and then inserting it, we insert
// an empty set, then put the prefix into said set. This should
// prevent a copy, though most compilers should be able to optimize
// this without our help.
if (HPX_UNLIKELY(!util::insert_checked(factories_.insert(
std::make_pair(cit->second, prefixes_type())), fit)))
{
l.unlock();
HPX_THROWS_IF(ec, lock_error
, "component_namespace::bind_prefix"
, "factory table insertion failed due to a locking "
"error or memory corruption");
return response();
}
fit->second.insert(prefix);
LAGAS_(info) << (boost::format(
"component_namespace::bind_prefix, key(%1%), prefix(%2%), ctype(%3%)")
% key % prefix % cit->second);
if (&ec != &throws)
ec = make_success_code();
//.........这里部分代码省略.........