summaryrefslogtreecommitdiff
path: root/modules/CIAO/connectors/ami4ccm/examples/Hello/Connector/AMI_MyFoo_i.cpp
blob: 8cdc2728ec0adfa497bf41d164fb783dfe3b4604 (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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
// $Id$

#include "AMI_MyFoo_i.h"
#include "Hello_BaseEC.h"
#include "tao/LocalObject.h"

class ExceptionHolder_i
    : public virtual ::CCM_AMI::CCM_ExceptionHolder,
      public virtual ::CORBA::LocalObject
{
public:
    ExceptionHolder_i (::Messaging::ExceptionHolder* holder) : holder_ (holder) {}

    virtual void raise_exception (void)
      {
        if (holder_)
          {
            holder_->raise_exception ();
          }
        else
          throw ::CORBA::UNKNOWN (TAO::VMCID, CORBA::COMPLETED_YES);
      }
private:
    ::Messaging::ExceptionHolder* holder_;
};

namespace CCM_CORBA_AMI_MyFoo_Impl
{
  //============================================================
  // Implementation of the AMI CORBA FOO reply handler
  //============================================================
  AMI_MyFoo_reply_handler::AMI_MyFoo_reply_handler (::Hello::AMI_MyFooCallback_ptr foo_callback)
  : foo_callback_ (::Hello::AMI_MyFooCallback::_duplicate (foo_callback))
  {
  }

  AMI_MyFoo_reply_handler::~AMI_MyFoo_reply_handler ()
  {
  }

  // FOO methods
  void
  AMI_MyFoo_reply_handler::foo (
    CORBA::Long result,
    const char * out_str)
  {
    printf ("AMI CORBA (FOO) :\tMyFoo Foo Reply Handler::foo\n");
    this->foo_callback_->foo (result, out_str);
    this->_remove_ref ();
  }

  void
  AMI_MyFoo_reply_handler::foo_excep (
    ::Messaging::ExceptionHolder * excep_holder)
  {
    printf ("AMI CORBA (FOO) :\tMyFoo Foo Reply Handler::foo_excep\n");
    ExceptionHolder_i holder (excep_holder);
    this->foo_callback_->foo_excep (&holder);
    this->_remove_ref ();
  }

  // HELLO methods
  void
  AMI_MyFoo_reply_handler::hello (
    CORBA::Long answer)
  {
    printf ("AMI CORBA (FOO) :\tMyFoo Hello Reply Handler::hello\n");
    this->foo_callback_->hello (answer);
    this->_remove_ref ();
  }

  void
  AMI_MyFoo_reply_handler::hello_excep (
    ::Messaging::ExceptionHolder * excep_holder)
  {
    printf ("AMI CORBA (FOO) :\tMyFoo Hello Reply Handler::hello_excep\n");
    ExceptionHolder_i holder (excep_holder);
    this->foo_callback_->hello_excep (&holder);
    this->_remove_ref ();
  }

  //GET rw_attrib Reply Handler
  void
  AMI_MyFoo_reply_handler::get_rw_attrib (
    ::CORBA::Short ami_return_val)
  {
    printf ("AMI CORBA (FOO) :\tMyFoo Hello Reply Handler::get_rw_atrrib\n");
    this->foo_callback_->get_rw_attrib (ami_return_val);
    this->_remove_ref ();
  }

  void
  AMI_MyFoo_reply_handler::get_rw_attrib_excep (
    ::Messaging::ExceptionHolder * excep_holder)
  {
    printf ("AMI CORBA (FOO) :\tMyFoo Hello Reply Handler::get_rw_attrib_excep\n");
    ExceptionHolder_i holder (excep_holder);
    this->foo_callback_->get_rw_attrib_excep (&holder);
    this->_remove_ref ();
  }

  //SET rw_attrib Reply Handler
  void
  AMI_MyFoo_reply_handler::set_rw_attrib ()
  {
    printf ("AMI CORBA (FOO) :\tMyFoo Hello Reply Handler::set_rw_attrib\n");
    this->foo_callback_->set_rw_attrib ();
    this->_remove_ref ();
  }

  void
  AMI_MyFoo_reply_handler::set_rw_attrib_excep (
    ::Messaging::ExceptionHolder * excep_holder)
  {
    printf ("AMI CORBA (FOO) :\tMyFoo Hello Reply Handler::set_rw_attrib_excep\n");
    ExceptionHolder_i holder (excep_holder);
    this->foo_callback_->set_rw_attrib_excep (&holder);
    this->_remove_ref ();
  }

  //ro_attrib Reply Handler
  void
  AMI_MyFoo_reply_handler::get_ro_attrib (
    ::CORBA::Short ami_return_val)
  {
    printf ("AMI CORBA (FOO) :\tMyFoo Hello Reply Handler::get_ro_attrib\n");
    this->foo_callback_->get_ro_attrib (ami_return_val);
    this->_remove_ref ();
  }

  void
  AMI_MyFoo_reply_handler::get_ro_attrib_excep (
    ::Messaging::ExceptionHolder * excep_holder)
  {
    printf ("AMI CORBA (FOO) :\tMyFoo Hello Reply Handler::get_ro_attrib_excep\n");
    ExceptionHolder_i holder (excep_holder);
    this->foo_callback_->get_ro_attrib_excep (&holder);
    this->_remove_ref ();
  }
}