本文整理汇总了C++中ACE_OutputCDR::write_char_array方法的典型用法代码示例。如果您正苦于以下问题:C++ ACE_OutputCDR::write_char_array方法的具体用法?C++ ACE_OutputCDR::write_char_array怎么用?C++ ACE_OutputCDR::write_char_array使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ACE_OutputCDR
的用法示例。
在下文中一共展示了ACE_OutputCDR::write_char_array方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
CmResult COFP10PacketOutMsg::StreamTo(ACE_OutputCDR &os)
{
CmResult lRet = CM_ERROR_FAILURE;
lRet = COFPMessage::StreamTo(os);
if (CM_FAILED(lRet))
{
ACE_ERROR((LM_ERROR, ACE_TEXT("COFP10PacketOutMsg::StreamTo, COFPMessage::StreamTo fail\n")));
return lRet;
}
os<<m_tMember.buffer_id;
os<<m_tMember.in_port;
os<<m_tMember.actions_len;
bool bGood = os.good_bit();
CM_ASSERT_RETURN(bGood, CM_ERROR_FAILURE);
std::list<COFP10Action *>::const_iterator it = m_action_list.begin();
while (it != m_action_list.end())
{
lRet = (*it)->StreamTo(os);
CM_ASSERT_RETURN(CM_SUCCEEDED(lRet), CM_ERROR_FAILURE);
it++;
}
if (m_PacketData)
{
ACE_DEBUG((LM_DEBUG,
ACE_TEXT("COFP10PacketOutMsg::StreamTo, m_PacketData->total_length() = %u\n"),
m_PacketData->total_length()));
std::string str = m_PacketData->flatten_chained();
os.write_char_array(str.c_str(), str.length());
}
bGood = os.good_bit();
CM_ASSERT_RETURN(bGood, CM_ERROR_FAILURE);
return CM_OK;
}
示例2: defined
int
operator<< (ACE_OutputCDR &cdr,
const ACE_Log_Record &log_record)
{
// The written message length can't be more than 32 bits (ACE_CDR::ULong)
// so reduce it here if needed.
ACE_CDR::ULong u_msglen =
ACE_Utils::truncate_cast<ACE_CDR::ULong> (log_record.msg_data_len ());
// Insert each field from <log_record> into the output CDR stream.
cdr << ACE_CDR::Long (log_record.type ());
cdr << ACE_CDR::Long (log_record.pid ());
cdr << ACE_CDR::LongLong (log_record.time_stamp ().sec ());
cdr << ACE_CDR::Long (log_record.time_stamp ().usec ());
cdr << u_msglen;
#if defined (ACE_USES_WCHAR)
cdr.write_wchar_array (log_record.msg_data (), u_msglen);
#else
cdr.write_char_array (log_record.msg_data (), u_msglen);
#endif /* ACE_USES_WCHAR */
return cdr.good_bit ();
}
示例3: GetMessageLength
CmResult COFP13PacketOutMsg::StreamTo(ACE_OutputCDR &os)
{
CmResult lRet = CM_ERROR_FAILURE;
ACE_CDR::Octet pad[6];
lRet = COFPMessage::StreamTo(os);
if (CM_FAILED(lRet))
{
ACE_ERROR((LM_ERROR, ACE_TEXT("COFP13PacketOutMsg::StreamTo, COFPMessage::StreamTo fail\n")));
return lRet;
}
ACE_DEBUG((LM_DEBUG, ACE_TEXT("COFP13PacketOutMsg::StreamTo():\n")));
ACE_DEBUG((LM_DEBUG, ACE_TEXT("msgLen=%u\n"), GetMessageLength()));
os<<m_buffer_id;
os<<m_in_port;
os<<m_actions_len;
os.write_octet_array(pad, sizeof(pad));
bool bGood = os.good_bit();
CM_ASSERT_RETURN(bGood, CM_ERROR_FAILURE);
ACE_DEBUG((LM_DEBUG, ACE_TEXT("m_actions_len=%u\n"), m_actions_len));
#if 0
while(!m_action_list.empty())
{
CCmComAutoPtr<COpenFlowProtAction> action;
action = m_action_list.front();
m_action_list.pop_front();
action->EncodeAction(os);
}
#endif
ACE_UINT16 i = 0;
std::list<COFP13Action *>::const_iterator it = m_action_list.begin();
while(it != m_action_list.end())
{
lRet = (*it)->StreamTo(os);
CM_ASSERT_RETURN(CM_SUCCEEDED(lRet), CM_ERROR_FAILURE);
ACE_DEBUG((LM_DEBUG, ACE_TEXT("action[%u]'s length=%u\n"), i++, (*it)->GetActionLen()));
bGood = os.good_bit();
CM_ASSERT_RETURN(bGood, CM_ERROR_FAILURE);
it++;
}
// just for debugging
ACE_UINT32 length = sizeof(m_buffer_id)+sizeof(m_in_port)+sizeof(m_actions_len)+sizeof(m_pad);
ACE_DEBUG((LM_DEBUG, ACE_TEXT("length=%u\n"), length));
ACE_INT32 dataLen = GetStreamLen()-COFPMessage::GetStreamLen()-length-m_actions_len;
ACE_DEBUG((LM_DEBUG, ACE_TEXT("dataLen=%d\n"), dataLen));
if (m_PacketData)
{
ACE_DEBUG((LM_DEBUG, ACE_TEXT("m_PacketData->total_length() = %u\n"), m_PacketData->total_length()));
std::string str = m_PacketData->flatten_chained();
bGood = os.write_char_array(str.c_str(), str.length());
CM_ASSERT_RETURN(bGood, CM_ERROR_FAILURE);
}
return CM_OK;
}