本文整理汇总了C++中msg_t类的典型用法代码示例。如果您正苦于以下问题:C++ msg_t类的具体用法?C++ msg_t怎么用?C++ msg_t使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了msg_t类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: close
int zmq::msg_t::copy (msg_t &src_)
{
// Check the validity of the source.
if (unlikely (!src_.check ())) {
errno = EFAULT;
return -1;
}
int rc = close ();
if (unlikely (rc < 0))
return rc;
if (src_.u.base.type == type_lmsg) {
// One reference is added to shared messages. Non-shared messages
// are turned into shared messages and reference count is set to 2.
if (src_.u.lmsg.flags & msg_t::shared)
src_.u.lmsg.content->refcnt.add (1);
else {
src_.u.lmsg.flags |= msg_t::shared;
src_.u.lmsg.content->refcnt.set (2);
}
}
*this = src_;
return 0;
}
示例2: close
int zmq::msg_t::move(msg_t &src_) {
// Check the validity of the source.
if (unlikely (!src_.check())) {
errno = EFAULT;
return -1;
}
int rc = close();
if (unlikely (rc < 0))
return rc;
*this = src_;
rc = src_.init();
if (unlikely (rc < 0))
return rc;
return 0;
}
示例3: get_msg
static inline int get_msg(msg_t& msg,int id){
int ret;
std::string str;
Json::Reader reader;
msg.clear();
assert_perror(id < 0);
if(!get_str_from_fd(id,str))
return 0;
reader.parse(str,msg,false);
return 1;
}
示例4:
bool zmq::pipe_t::is_delimiter (msg_t &msg_)
{
return msg_.is_delimiter ();
}