本文整理汇总了C++中parcel::get_parcel_id方法的典型用法代码示例。如果您正苦于以下问题:C++ parcel::get_parcel_id方法的具体用法?C++ parcel::get_parcel_id怎么用?C++ parcel::get_parcel_id使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类parcel
的用法示例。
在下文中一共展示了parcel::get_parcel_id方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: serialize_certificate
void serialize_certificate(Archive& archive, Connection & connection,
std::set<boost::uint32_t>& localities, parcel const& p)
{
// We send the certificate corresponding to the originating locality
// of the parcel if this is the first message over this connection
// or if the originating locality is not the current one.
boost::uint32_t locality_id =
naming::get_locality_id_from_gid(p.get_parcel_id());
error_code ec(lightweight);
boost::uint32_t this_locality_id = get_locality_id(ec);
if (ec) {
// this should only happen during bootstrap
HPX_ASSERT(hpx::is_starting());
this_locality_id = locality_id;
}
bool has_certificate = false;
if ((connection.first_message_ || locality_id != this_locality_id) &&
localities.find(locality_id) == localities.end())
{
// the first message must originate from this locality
HPX_ASSERT(!connection.first_message_ || locality_id == this_locality_id);
components::security::signed_certificate const& certificate =
hpx::get_locality_certificate(locality_id, ec);
if (!ec) {
has_certificate = true;
if (locality_id == this_locality_id)
connection.first_message_ = false;
archive << has_certificate << certificate;
// keep track of all certificates already prepended for this message
localities.insert(locality_id);
}
else {
// if the certificate is not available we have to still be on
// the 'first' message (it's too early for a certificate)
HPX_ASSERT(connection.first_message_);
archive << has_certificate;
}
}
else {
archive << has_certificate;
}
}
示例2: put_parcel
void parcelport::put_parcel(parcel const& p, write_handler_type const& f)
{
typedef pending_parcels_map::iterator iterator;
typedef pending_parcels_map::mapped_type mapped_type;
naming::locality locality_id = p.get_destination_locality();
naming::gid_type parcel_id = p.get_parcel_id();
// enqueue the incoming parcel ...
{
lcos::local::spinlock::scoped_lock l(mtx_);
mapped_type& e = pending_parcels_[locality_id];
e.first.push_back(p);
e.second.push_back(f);
}
get_connection_and_send_parcels(locality_id, parcel_id);
}
示例3: data_buffer_name
boost::shared_ptr<parcel_buffer_type> get_buffer(parcel const & p, std::size_t arg_size)
{
// generate the name for this data_buffer
std::string data_buffer_name(p.get_parcel_id().to_string());
if(!buffer_)
{
// clear and preallocate out_buffer_ (or fetch from cache)
buffer_ = boost::make_shared<parcel_buffer_type>(
get_data_buffer((arg_size * 12) / 10 + 1024,
data_buffer_name)
);
}
else
{
buffer_->data_ =
get_data_buffer((arg_size * 12) / 10 + 1024,
data_buffer_name);
}
return buffer_;
}
示例4: put_parcel
void parcelhandler::put_parcel(parcel& p, write_handler_type f)
{
// properly initialize parcel
init_parcel(p);
std::vector<naming::gid_type> const& gids = p.get_destinations();
std::vector<naming::address>& addrs = p.get_destination_addrs();
if (1 == gids.size()) {
if (!addrs[0])
resolver_.resolve(gids[0], addrs[0]);
}
else {
boost::dynamic_bitset<> locals;
resolver_.resolve(gids, addrs, locals);
}
if (!p.get_parcel_id())
p.set_parcel_id(parcel::generate_unique_id());
pp_.put_parcel(p, f);
}
示例5: add_parcel
bool add_parcel(parcel const& p)
{
naming::gid_type id(p.get_parcel_id());
// Add parcel to queue.
{
mutex_type::scoped_lock l(mtx_);
std::pair<parcel_map_type::iterator, bool> ret =
parcels_.insert(parcel_map_type::value_type(id, p));
if (!ret.second) {
HPX_THROW_EXCEPTION(bad_parameter,
"global_parcelhandler_queue::add_parcel",
"Could not add received parcel to the parcelhandler "
"queue");
return false;
}
}
// do some work (notify event handlers)
HPX_ASSERT(ph_ != 0);
notify_(*ph_, id);
return true;
}