2 //=============================================================================
4 * @file octet_sequence.cpp
6 * Verifies that reference counting is performed correctly for octet
9 * @author Dave Meyer (dmeyer@std.saic.com)Carlos O'Ryan (coryan@cs.wustl.edu)
11 //=============================================================================
14 #include "ace/Log_Msg.h"
17 #include "ace/OS_NS_string.h"
19 ACE_Message_Block
* m1
;
20 ACE_Message_Block
* m2
;
21 ACE_Message_Block
* m3
;
23 void dump (const char * msg
)
31 m1
->data_block()->reference_count(),
32 m2
->data_block()->reference_count(),
33 m3
->data_block()->reference_count()));
36 int ACE_TMAIN (int, ACE_TCHAR
*[])
40 m1
=new ACE_Message_Block(1024);
41 ACE_OS::memset(buf
,'1',512);
43 m2
=new ACE_Message_Block(1024);
44 ACE_OS::memset(buf
,'2',512);
46 m3
=new ACE_Message_Block(1024);
47 ACE_OS::memset(buf
,'3',512);
54 ACE_Message_Block
* m
= ACE_Message_Block::duplicate (m1
);
59 cdr
.write_octet_array_mb(m1
);
60 dump("expect 3,3,3"); // that's what I expected, anyway
61 ACE_DEBUG ((LM_INFO
, "total cdr length is %u\n",
62 static_cast<u_int
> (cdr
.total_length())));
64 dump("expect 2,2,2"); // that's what I expected, anyway
66 ACE_Message_Block::release (m
);
67 dump("expect 1,1,1"); // that's what I expected, anyway
68 ACE_Message_Block::release (m1
);