blob: 04f187eb8140acfc91ac7738a19b7f723369a76c (
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
72
73
74
75
76
77
78
79
|
#include "Echo_i.h"
constexpr size_t BIG_LENGTH = 4 * 1024;
// Constructor.
Echo_i::Echo_i (CORBA::ORB_ptr o)
: orb_(o)
{
}
// Return a list of strings.
Echo::List *
Echo_i::return_list ()
{
Echo::List_var list;
{
Echo::List *tmp {};
ACE_NEW_RETURN (tmp,
Echo::List (2),
{});
list = tmp;
}
list->length (2);
// Just do something to get a 'big' list of strings.
CORBA::Char big[BIG_LENGTH + 1];
for (size_t i = 0; i < BIG_LENGTH; ++i)
big[i] = 'A';
big[BIG_LENGTH] = 0;
list[CORBA::ULong(0)] = CORBA::string_dup(big);
list[CORBA::ULong(1)] = CORBA::string_dup("Hello World");
return list._retn ();
}
Echo::WList *
Echo_i::return_wlist ()
{
Echo::WList_var list;
{
Echo::WList *tmp {};
ACE_NEW_RETURN (tmp,
Echo::WList (2),
{});
list = tmp;
}
list->length (2);
// Just do something to get a 'big' list of wide strings.
CORBA::WChar big[BIG_LENGTH + 1];
for (size_t i = 0; i < BIG_LENGTH; ++i)
big[i] = 'A';
big[BIG_LENGTH] = 0;
CORBA::WChar small[17 + 1];
for (size_t i = 0; i < 17; ++i)
small[i] = 'B';
small[17] = 0;
list[CORBA::ULong(0)] = CORBA::wstring_dup(big);
list[CORBA::ULong(1)] = CORBA::wstring_dup(small);
return list._retn ();
}
// Shutdown the server application.
void
Echo_i::shutdown ()
{
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("\nThe echo server is shutting down\n")));
// Instruct the ORB to shutdown.
this->orb_->shutdown ();
}
|