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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
// $Id$
// ============================================================================
//
// = LIBRARY
// tests
//
// = FILENAME
// DLL_Test.cpp
//
// = DESCRIPTION
// This test illustrates the use of <ACE_DLL> wrapper class.
//
// = AUTHOR
// Kirthika Parameswaran <kirthika@cs.wustl.edu>
//
// ============================================================================
#include "DLL_Test_Impl.h"
#include "ace/ACE.h"
#include "ace/OS_Errno.h"
#include "ace/svc_export.h"
ACE_RCSID (tests,
DLL_Test_Impl,
"$Id$")
Hello_Impl::Hello_Impl (void)
{
ACE_DEBUG ((LM_DEBUG, "Hello_Impl::Hello_Impl\n"));
}
Hello_Impl::~Hello_Impl (void)
{
ACE_DEBUG ((LM_DEBUG, "Hello_Impl::~Hello_Impl\n"));
}
void
Hello_Impl::say_next (void)
{
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("How are you?\n")));
}
ACE_TCHAR *
Hello_Impl::new_info (void)
{
return ACE::strnew (ACE_TEXT ("Hello_Impl::new_info() allocated by ACE::strnew()"));
}
ACE_TCHAR *
Hello_Impl::malloc_info (void)
{
return ACE_OS_String::strdup (ACE_TEXT ("Hello_Impl::new_info() allocated by ACE_OS_Memory::malloc()"));
}
void *
Hello_Impl::operator new (size_t bytes)
{
ACE_DEBUG ((LM_INFO, "Hello_Impl::new\n"));
return ::new char[bytes];
}
#if defined (ACE_HAS_NEW_NOTHROW)
/// Overloaded new operator, nothrow_t variant.
void *
Hello_Impl::operator new (size_t bytes, const ACE_nothrow_t &nt)
{
ACE_DEBUG ((LM_INFO, "Hello_Impl::new\n"));
return ::new (nt) char[bytes];
}
#endif /* ACE_HAS_NEW_NOTHROW */
void
Hello_Impl::operator delete (void *ptr)
{
ACE_DEBUG ((LM_INFO, "Hello_Impl::delete\n"));
delete [] ((char *) ptr);
}
extern "C" ACE_Svc_Export Hello *
get_hello (void)
{
Hello *hello = 0;
ACE_NEW_RETURN (hello,
Hello_Impl,
NULL);
return hello;
}
class Static_Constructor_Test
{
public:
Static_Constructor_Test (void)
{
ACE_DEBUG ((LM_DEBUG,
"Static_Constructor_Test::Static_Constructor_Test\n"));
}
~Static_Constructor_Test (void)
{
ACE_DEBUG ((LM_DEBUG,
"Static_Constructor_Test::~Static_Constructor_Test\n"));
}
};
static Static_Constructor_Test the_instance;
// Test dynamic cast
extern "C" ACE_Svc_Export int
dynamic_cast_test (Parent *target)
{
return target == dynamic_cast<Child*>( target )? 0 : -1;
}
|