summaryrefslogtreecommitdiff
path: root/TAO/tests/Bug_2805_Regression/ami_test_i.cpp
blob: c019047248bffc3147fb6cd735bdef018ebb76f9 (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
96
97
98
99

//=============================================================================
/**
 *  @file    ami_test_i.cpp
 *
 *  $Id$
 *
 *  Implementation of the AMI Test interface.
 *
 *
 *  @author Alexander Babu Arulanthu <alex@cs.wustl.edu>
 *  @author Michael Kircher <Michael.Kircher@mchp.siemens.de>
 */
//=============================================================================


#include "ami_test_i.h"
#include "tao/debug.h"

ACE_RCSID(AMI, ami_test_i, "$Id$")

AMI_Test_i::AMI_Test_i (CORBA::ORB_ptr orb,
                        CORBA::Long in_l,
                        const char * in_str,
                        bool check_params)
  :  orb_ (CORBA::ORB::_duplicate (orb)),
     number_ ((CORBA::Long) 931232),
     yadda_ ((CORBA::Long) 140474),
     in_l_ (in_l),
     in_str_(CORBA::string_dup(in_str)),
     check_params_(check_params)
{
}

CORBA::Long
AMI_Test_i::foo (CORBA::Long_out out_l,
                 CORBA::Long in_l,
                 const char* in_str)
{
  out_l = 931233;

  //if (TAO_debug_level > 0)
  ACE_DEBUG ((LM_DEBUG,
              "%N:%l:(%P:%t):AMI_Test_i::foo:  %d %C\n",
              in_l,
              in_str));

  if (in_l == 0)
    {
      ACE_DEBUG ((LM_DEBUG,
                  "Throwing Exception: A::DidTheRightThing\n"));
      throw A::DidTheRightThing();
    }

  if (check_params_)
    {
      if (in_l_ != in_l || ACE_OS::strcmp(in_str_.in (), in_str) != 0)
        {
          ACE_ERROR ((LM_ERROR,
                      "ERROR: Parameter corruption on in parameters: %d %d %C %C.\n",
                      in_l_, in_l, in_str_.in (), in_str));
          return 0;
        }
    }

  return 931234;
}

void
AMI_Test_i::shutdown (void)
{
  this->orb_->shutdown (0);
}


CORBA::Long
AMI_Test_i::yadda (void)
{
  ACE_DEBUG ((LM_DEBUG,
              "%N:%l:(%P:%t):AMI_Test_i::(get_)yadda\n"));
  return yadda_;
}


void
AMI_Test_i::yadda (CORBA::Long yadda)
{
  ACE_DEBUG ((LM_DEBUG,
              "%N:%l:(%P:%t):AMI_Test_i::(set_)yadda\n"));
  yadda_ = yadda;
}

void
AMI_Test_i::inout_arg_test (char *&)
{
  // No action, this operation is to test code generation for INOUT
  // args in AMI operations.
}