summaryrefslogtreecommitdiff
path: root/TAO/tests/Bug_1676_Regression/Hello.cpp
blob: 6e120fe9bbd1e077d93bad781839a30ad5d5ebec (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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
//
// $Id$
//
#include "Hello.h"

ACE_RCSID(Hello, Hello, "$Id$")

Hello::Hello (CORBA::ORB_ptr orb)
  : orb_ (CORBA::ORB::_duplicate (orb))
{
}

#if 0
char *
Hello::get_string (void)
  ACE_THROW_SPEC ((CORBA::SystemException))
{
  return CORBA::string_dup ("Hello there!");
}
#endif

::Test::StringList *
Hello::get_stringList (
	//
	)
	ACE_THROW_SPEC ((
	::CORBA::SystemException
	))
{
	Test::StringList * seq;
    ACE_NEW_RETURN (seq,
		Test::StringList(10),
                    0);
    seq->length(10);
	for (CORBA::ULong i = 0; i<seq->length(); i++)
	{
		char tmp[255] = {0};
		sprintf(tmp, "Hello World %d", i);
		(*seq)[i] = CORBA::string_dup(tmp);
	}

	return seq;
}

void
Hello::get_stringList2 (
        ::CORBA::Boolean initialize,
        ::Test::StringList_out osl
      )
      ACE_THROW_SPEC ((
        ::CORBA::SystemException
      ))
{
    // CORBA::String_var the_string = osl->length();
    // ACE_DEBUG ((LM_DEBUG, "(%P|%t) - Entering get_stringList2(%.4d)\n", osl));

    if (initialize) {
        ACE_NEW (osl,
		    Test::StringList(10));

        osl->length(5);
        for (CORBA::ULong i = 0; i<osl->length(); i++)
	    {
		    char tmp[255] = {0};
		    sprintf(tmp, "Hello Again %d", i);
		    (*osl)[i] = CORBA::string_dup(tmp);
	    }
    }
}

void
Hello::mod_stringList (
        ::Test::StringList & iosl
      )
      ACE_THROW_SPEC ((
        ::CORBA::SystemException
      ))
{
    // osl->length(10);
    for (CORBA::ULong i = 0; i<iosl.length(); i++)
	{
		char tmp[255] = {0};
		sprintf(tmp, "Hello Client %d", i);
        if (i%2) {
		    iosl[i] = CORBA::string_dup(tmp);
        }
	}
}

void
Hello::shutdown (void)
  ACE_THROW_SPEC ((CORBA::SystemException))
{
  this->orb_->shutdown (0);
}