Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / TAO / tests / GIOP_Fragments / Big_String_Sequence / Echo_i.cpp
blob04f187eb8140acfc91ac7738a19b7f723369a76c
1 #include "Echo_i.h"
3 constexpr size_t BIG_LENGTH = 4 * 1024;
5 // Constructor.
7 Echo_i::Echo_i (CORBA::ORB_ptr o)
8 : orb_(o)
12 // Return a list of strings.
13 Echo::List *
14 Echo_i::return_list ()
16 Echo::List_var list;
19 Echo::List *tmp {};
20 ACE_NEW_RETURN (tmp,
21 Echo::List (2),
22 {});
23 list = tmp;
26 list->length (2);
28 // Just do something to get a 'big' list of strings.
29 CORBA::Char big[BIG_LENGTH + 1];
30 for (size_t i = 0; i < BIG_LENGTH; ++i)
31 big[i] = 'A';
32 big[BIG_LENGTH] = 0;
33 list[CORBA::ULong(0)] = CORBA::string_dup(big);
34 list[CORBA::ULong(1)] = CORBA::string_dup("Hello World");
36 return list._retn ();
39 Echo::WList *
40 Echo_i::return_wlist ()
42 Echo::WList_var list;
45 Echo::WList *tmp {};
46 ACE_NEW_RETURN (tmp,
47 Echo::WList (2),
48 {});
49 list = tmp;
52 list->length (2);
54 // Just do something to get a 'big' list of wide strings.
55 CORBA::WChar big[BIG_LENGTH + 1];
56 for (size_t i = 0; i < BIG_LENGTH; ++i)
57 big[i] = 'A';
58 big[BIG_LENGTH] = 0;
59 CORBA::WChar small[17 + 1];
60 for (size_t i = 0; i < 17; ++i)
61 small[i] = 'B';
62 small[17] = 0;
63 list[CORBA::ULong(0)] = CORBA::wstring_dup(big);
64 list[CORBA::ULong(1)] = CORBA::wstring_dup(small);
66 return list._retn ();
69 // Shutdown the server application.
71 void
72 Echo_i::shutdown ()
74 ACE_DEBUG ((LM_DEBUG,
75 ACE_TEXT ("\nThe echo server is shutting down\n")));
77 // Instruct the ORB to shutdown.
78 this->orb_->shutdown ();