blob: 5b67488b4051363e646da409a30cf80a7e600d5a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
// The following code illustrates how the ACE_Dumpable mechanisms are
// $Id$
// integrated into ACE components like the SOCK_Acceptor and
// SOCK_Stream.
#include "ace/Dump.h"
class SOCK
{
public:
SOCK (void) { ACE_REGISTER_OBJECT (SOCK); }
~SOCK (void) { ACE_REMOVE_OBJECT; }
void dump (void) const {
cerr << "hello from SOCK = " << (u_long) this << endl;
}
// ...
};
class SOCK_Acceptor : public SOCK
{
public:
SOCK_Acceptor (void) { ACE_REGISTER_OBJECT (SOCK_Acceptor); }
~SOCK_Acceptor (void) { ACE_REMOVE_OBJECT; }
void dump (void) const {
cerr << "hello from SOCK_Acceptor = " << (u_long) this << endl;
}
// ...
};
class SOCK_Stream : public SOCK
{
public:
SOCK_Stream (void) { ACE_REGISTER_OBJECT (SOCK_Stream); }
~SOCK_Stream (void) { ACE_REMOVE_OBJECT; }
void dump (void) const {
cerr << "hello from SOCK_Stream = " << (u_long) this << endl;
}
// ...
};
int
main (void)
{
SOCK outer_sock;
// Note that the SOCK superclass is *not* printed.
SOCK_Stream outer_stream;
SOCK_Acceptor outer_acceptor;
ACE_ODB::instance ()->dump_objects ();
{
SOCK inner_sock;
// Note that the SOCK superclass is *not* printed.
SOCK_Stream inner_stream;
SOCK_Acceptor inner_acceptor;
ACE_ODB::instance ()->dump_objects ();
}
ACE_ODB::instance ()->dump_objects ();
return 0;
}
#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION)
template class ACE_Dumpable_Adapter<SOCK_Stream>;
template class ACE_Dumpable_Adapter<SOCK>;
template class ACE_Dumpable_Adapter<SOCK_Acceptor>;
#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */
|