当前位置: 首页>>代码示例>>C++>>正文


C++ ACE_Log_Record::priority方法代码示例

本文整理汇总了C++中ACE_Log_Record::priority方法的典型用法代码示例。如果您正苦于以下问题:C++ ACE_Log_Record::priority方法的具体用法?C++ ACE_Log_Record::priority怎么用?C++ ACE_Log_Record::priority使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ACE_Log_Record的用法示例。


在下文中一共展示了ACE_Log_Record::priority方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: log

//
// log
//
ssize_t CUTS_ACE_Msg_Backend::log (ACE_Log_Record &log_record)
{
  this->logger_.log (log_record.priority (),
                     log_record.msg_data (),
                     log_record.length ());

  // Manually invoke the old message callback
  if (this->old_msg_backend_ != 0)
    this->old_msg_backend_->log (log_record);

  return log_record.length ();
}
开发者ID:SEDS,项目名称:CUTS,代码行数:15,代码来源:ACE_Msg_Backend.cpp

示例2: payload

ssize_t
ACE_Log_Msg_IPC::log (ACE_Log_Record &log_record)
{
    // Serialize the log record using a CDR stream, allocate enough
    // space for the complete <ACE_Log_Record>.
    size_t const max_payload_size =
        4    // type
        + 4  // pid
        + 12 // timestamp
        + 4  // process id
        + 4  // data length
#if defined (ACE_USES_WCHAR)
        + (log_record.msg_data_len () * ACE_OutputCDR::wchar_maxbytes())  // message
#else
        + log_record.msg_data_len () // message
#endif
        + ACE_CDR::MAX_ALIGNMENT;     // padding;

    // Insert contents of <log_record> into payload stream.
    ACE_OutputCDR payload (max_payload_size);
    payload << log_record;

    // Get the number of bytes used by the CDR stream. If it becomes desireable
    // to support payloads more than 4GB, this field will need to be changed
    // to a 64-bit value.
    ACE_CDR::ULong length =
        ACE_Utils::truncate_cast<ACE_CDR::ULong> (payload.total_length ());

    // Send a header so the receiver can determine the byte order and
    // size of the incoming CDR stream.
    ACE_OutputCDR header (ACE_CDR::MAX_ALIGNMENT + 8);
    header << ACE_OutputCDR::from_boolean (ACE_CDR_BYTE_ORDER);

    // Store the size of the payload that follows
    header << ACE_CDR::ULong (length);

    // Use an iovec to send both buffer and payload simultaneously.
    iovec iov[2];
    iov[0].iov_base = header.begin ()->rd_ptr ();
    iov[0].iov_len  = 8;
    iov[1].iov_base = payload.begin ()->rd_ptr ();
    iov[1].iov_len  = length;

#if defined (ACE_HAS_STREAM_PIPES)
    // Use the <putpmsg> API if supported to ensure correct message
    // queueing according to priority.

    ACE_Str_Buf header_msg (static_cast<void *> (header.begin ()->rd_ptr ()),
                            static_cast<int> (8));

    ACE_Str_Buf payload_msg (static_cast<void *> (payload.begin ()->rd_ptr ()),
                             static_cast<int> (length));

    return this->message_queue_.send (&header_msg,
                                      &payload_msg,
                                      static_cast<int> (log_record.priority ()),
                                      MSG_BAND);
#else
    // We're running over sockets, so send header and payload
    // efficiently using "gather-write".
    return this->message_queue_.sendv_n (iov, 2);
#endif /* ACE_HAS_STREAM_PIPES */
}
开发者ID:BACKUPLIB,项目名称:Core,代码行数:63,代码来源:Log_Msg_IPC.cpp


注:本文中的ACE_Log_Record::priority方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。