本文整理汇总了C++中ACE_InputCDR::rd_ptr方法的典型用法代码示例。如果您正苦于以下问题:C++ ACE_InputCDR::rd_ptr方法的具体用法?C++ ACE_InputCDR::rd_ptr怎么用?C++ ACE_InputCDR::rd_ptr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ACE_InputCDR
的用法示例。
在下文中一共展示了ACE_InputCDR::rd_ptr方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: get_opt
int
main (int argc, ACE_TCHAR *argv[])
{
ACE_START_TEST (ACE_TEXT ("CDR_Test"));
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("This is ACE Version %u.%u.%u\n\n"),
ACE::major_version (),
ACE::minor_version(),
ACE::beta_version()));
ACE_Get_Opt get_opt (argc, argv, ACE_TEXT ("dn:l:"));
int opt;
int debug = 0;
while ((opt = get_opt ()) != EOF)
{
switch (opt)
{
case 'd':
debug++;
break;
case 'n':
n = ACE_OS::atoi (get_opt.optarg);
break;
case 'l':
nloops = ACE_OS::atoi (get_opt.optarg);
break;
case '?':
default:
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("Usage: %s ")
ACE_TEXT ("-d debug")
ACE_TEXT ("-n <num> ")
ACE_TEXT ("-l <loops> ")
ACE_TEXT ("\n"),
argv[0]));
return -1;
}
}
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("Testing ACE CDR functions - short stream\n\n")));
if (short_stream () != 0 )
return 1;
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("Short stream - no errors\n\n")
ACE_TEXT ("Testing basic types - long stream\n\n")));
for (int i = 0; i < nloops; ++i)
{
ACE_OutputCDR output;
CDR_Test_Types test_types;
if (test_types.test_put (output) != 0)
return 1;
ACE_InputCDR input (output);
if (debug > 0)
{
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("Output CDR: \n")));
ACE_HEX_DUMP ((LM_DEBUG,
input.rd_ptr(),
64));
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("Input CDR: \n")));
ACE_HEX_DUMP ((LM_DEBUG,
input.rd_ptr(),
64));
}
if (test_types.test_get (input) != 0)
return 1;
}
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("Long stream - no errors\n\n")
ACE_TEXT ("Testing basic types - long stream[2]\n\n")));
for (int j = 0; j < nloops; ++j)
{
ACE_OutputCDR output;
CDR_Test_Types test_types;
if (test_types.test_put (output) != 0)
return 1;
ACE_InputCDR input (output.begin ());
if (debug > 0)
{
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("Output CDR: \n")));
ACE_HEX_DUMP ((LM_DEBUG,
input.rd_ptr(),
64));
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("Input CDR: \n")));
//.........这里部分代码省略.........
示例2: os
//.........这里部分代码省略.........
os << T(0);
}
i = 0;
Crono crono;
crono.start();
while (i < total)
{
os << idata[i++];
os << idata[i++];
os << idata[i++];
os << idata[i++];
// static char rs[32 + 1];
// CDR_Test<T,H>::ttoh (idata[i], rs);
// ACE_DEBUG ((LM_DEBUG, "Write idata[%d] = %s\n", i, rs));
// os << idata[i];
// i++;
}
crono.stop ();
secs = crono.read_seconds ();
}
if (!check_seal(end))
{
ACE_ERROR((LM_ERROR,
ACE_TEXT( "Broken seal, aborting.\n" )));
ACE_OS::exit(1);
}
totalsecs += secs;
if (n == niter - 1)
{
toread = os.begin ()->rd_ptr ();
}
}
totalsecs = totalsecs / niter;
ACE_DEBUG((LM_DEBUG,
ACE_TEXT ("Writing to stream %d %s values: %f seconds.\n"),
total,
H::name (),
totalsecs));
}
{
int i;
for (i = 0; i < total; i++)
{
idata[i] = 0;
}
}
ACE_DEBUG((LM_DEBUG,
ACE_TEXT( "Reading them back in opposing byte order...\n" )));
const int opposite_byte_order = 1 - ACE_CDR_BYTE_ORDER;
{
double totalsecs = 0.0;
int n;
for (n = 0; n < niter; n++)
{
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("====== Read iteration %d\n"), n));