本文整理汇总了C++中ACE_OutputCDR::write_double_array方法的典型用法代码示例。如果您正苦于以下问题:C++ ACE_OutputCDR::write_double_array方法的具体用法?C++ ACE_OutputCDR::write_double_array怎么用?C++ ACE_OutputCDR::write_double_array使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ACE_OutputCDR
的用法示例。
在下文中一共展示了ACE_OutputCDR::write_double_array方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: str
static int
short_stream (void)
{
// counter
u_int i;
// Build an output stream
ACE_OutputCDR os;
// Basic types for output
ACE_CDR::Char ch = 'A';
ACE_CDR::Char wchtmp[] = {"\xF3"};
ACE_CDR::WChar wch = *wchtmp;
ACE_CString str ("Test String");
ACE_CDR::Short s = -123;
ACE_CDR::UShort us = 123;
ACE_CDR::Long l = -65800L;
ACE_CDR::ULong ul = 65800UL;
ACE_CDR::Float f = 1.23f;
ACE_CDR::Double d = 123.456789;
// Arrays for output
ACE_CDR::Short s_array[3] = { -1, 0, 1 };
ACE_CDR::Long l_array[3] = { -345678, 0, 345678 };
ACE_CDR::Float f_array[3] = { -1.23f, 0.0f, 1.23f };
ACE_CDR::Double d_array[3] = { -123.456789, 0.0, 123.456789 };
ACE_OutputCDR::from_char fc (ch);
os << fc;
ACE_OutputCDR::from_wchar fwc (wch);
os << fwc;
os << str;
os << s;
os << us;
os << l;
os << ul;
os << f;
os << d;
os.write_short_array (s_array, 3);
os.write_long_array (l_array, 3);
os.write_float_array (f_array, 3);
os.write_double_array (d_array, 3);
const ACE_Message_Block *out_mb = os.begin ();
u_int len = out_mb->length ();
// Create an input stream (copy constructor)
ACE_InputCDR is (os);
const ACE_Message_Block *in_mb = is.start ();
if (in_mb->length () != len)
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("%p\n"),
ACE_TEXT ("buffer length not preserved")),
1);
u_long in_chunk, out_chunk;
for (i = 0; i < len; i++)
{
in_chunk = u_long (* (in_mb->rd_ptr () + i));
out_chunk = u_long (* (out_mb->rd_ptr () + i));
if (in_chunk != out_chunk )
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("%p\n"),
ACE_TEXT ("buffer contents not preserved")),
1);
}
// Basic types for input
ACE_CDR::Char ch1 = '\0';
ACE_CDR::WChar wch1 = '\x00';
ACE_CString str1;
ACE_CDR::Short s1 = 0;
ACE_CDR::UShort us1 = 0;
ACE_CDR::Long l1 = 0L;
ACE_CDR::ULong ul1 = 0UL;
ACE_CDR::Float f1 = 0.0f;
ACE_CDR::Double d1 = 0.0;
// Arrays for input
ACE_CDR::Short s_array1[3];
ACE_CDR::Long l_array1[3];
ACE_CDR::Float f_array1[3];
ACE_CDR::Double d_array1[3];
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("Checking operators and arrays\n\n")));
ACE_InputCDR::to_char tc (ch1);
is >> tc;
ACE_InputCDR::to_wchar twc (wch1);
is >> twc;
is >> str1;
is >> s1;
is >> us1;
is >> l1;
is >> ul1;
is >> f1;
is >> d1;
//.........这里部分代码省略.........