summaryrefslogtreecommitdiff
path: root/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleAttribute_exec.cpp
blob: 5a67065c47105a5f4d8de5fe5be9588d207010e8 (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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
// $Id$

#include "SimpleAttribute_exec.h"
#include "DAnCE/Logger/Log_Macros.h"

namespace CIAO_Simple_SimpleAttribute_Impl
{
  //==================================================================
  // Component Executor Implementation Class:   SimpleAttribute_exec_i
  //==================================================================

  SimpleAttribute_exec_i::SimpleAttribute_exec_i (void)
    : str_ (""),
      long_(-1),
      short_(-1)
  {
  }

  SimpleAttribute_exec_i::~SimpleAttribute_exec_i (void)
  {
  }

  // Supported or inherited operations.

  // Attribute operations.

  char *
  SimpleAttribute_exec_i::str_attr ()
  {
    // Your code here.
    return CORBA::string_dup (str_.c_str ());
  }

  void
  SimpleAttribute_exec_i::str_attr (const char * str)
  {
    DANCE_TRACE ("SimpleAttribute_exec_i::str_attr");
    // Your code here.
    this->str_ = str;
  }

  ::CORBA::Long
  SimpleAttribute_exec_i::long_attr ()
  {
    DANCE_TRACE ("SimpleAttribute_exec_i::long_attr");
    // Your code here.
    return long_;
  }

  void
  SimpleAttribute_exec_i::long_attr (::CORBA::Long long_attr )
  {
    DANCE_TRACE ("SimpleAttribute_exec_i::long_attr");
    // Your code here.
    this->long_ = long_attr;
  }

  ::CORBA::Short
  SimpleAttribute_exec_i::short_attr ()
  {
    // Your code here.
    return short_;
  }

  void
  SimpleAttribute_exec_i::short_attr (::CORBA::Short short_attr )
  {
    DANCE_TRACE ("SimpleAttribute_exec_i::short_attr");
    // Your code here.
    this->short_ = short_attr;
  }

  // Port operations.

  // Operations from Components::SessionComponent

  void
  SimpleAttribute_exec_i::set_session_context (
    ::Components::SessionContext_ptr ctx)
  {
    this->context_ =
      ::Simple::CCM_SimpleAttribute_Context::_narrow (ctx);

    if (CORBA::is_nil (this->context_.in ()))
    {
      throw ::CORBA::INTERNAL ();
    }
  }

  void
  SimpleAttribute_exec_i::configuration_complete ()
  {
    // Your code here.
  }

  void
  SimpleAttribute_exec_i::ccm_activate ()
  {
    // Your code here.
    if (this->str_ == "" ||
        this->long_ == -1 ||
        this->short_ == -1)
      {
        ACE_ERROR ((LM_ERROR, "SimpleAttribute_exec_i::ccm_activate - "
                     "Error: Attribute values didin't initialize correctly!\n"));
      }
    else
      {
        ACE_DEBUG ((LM_EMERGENCY, "SimpleAttribute_exec_i::ccm_activate - "
                     "Test passed!  String attribute is %s\n",
                     this->str_.c_str ()));
      }

  }

  void
  SimpleAttribute_exec_i::ccm_passivate ()
  {
    // Your code here.
  }

  void
  SimpleAttribute_exec_i::ccm_remove ()
  {
    // Your code here.
  }

  //==================================================================
  // Home Executor Implementation Class:   SimpleAttributeHome_exec_i
  //==================================================================

  SimpleAttributeHome_exec_i::SimpleAttributeHome_exec_i (void)
    : str_ (""),
      long_(-1),
      short_(-1)
  {
  }

  SimpleAttributeHome_exec_i::~SimpleAttributeHome_exec_i (void)
  {
  }

  // Supported or inherited operations.

  // Home operations.

  // Factory and finder operations.

  // Attribute operations.


  char *
  SimpleAttributeHome_exec_i::str_attr ()
  {
    // Your code here.
    return CORBA::string_dup (str_.c_str ());
  }

  void
  SimpleAttributeHome_exec_i::str_attr (const char * str)
  {
    DANCE_TRACE ("SimpleAttributeHome_exec_i::str_attr");
    // Your code here.
    this->str_ = str;
  }

  ::CORBA::Long
  SimpleAttributeHome_exec_i::long_attr ()
  {
    DANCE_TRACE ("SimpleAttributeHome_exec_i::long_attr");
    // Your code here.
    return long_;
  }

  void
  SimpleAttributeHome_exec_i::long_attr (::CORBA::Long long_attr )
  {
    DANCE_TRACE ("SimpleAttributeHome_exec_i::long_attr");
    // Your code here.
    this->long_ = long_attr;
  }

  ::CORBA::Short
  SimpleAttributeHome_exec_i::short_attr ()
  {
    // Your code here.
    return short_;
  }

  void
  SimpleAttributeHome_exec_i::short_attr (::CORBA::Short short_attr )
  {
    DANCE_TRACE ("SimpleAttributeHome_exec_i::short_attr");
    // Your code here.
    this->short_ = short_attr;
  }

  // Implicit operations.

  ::Components::EnterpriseComponent_ptr
  SimpleAttributeHome_exec_i::create ()
  {
    if (this->str_ == "" ||
        this->long_ == -1 ||
        this->short_ == -1)
      {
        ACE_ERROR ((LM_ERROR, "SimpleAttributeHom_exec_i::create - "
                     "Error: Attribute values didin't initialize correctly!\n"));
      }
    else
      {
        ACE_DEBUG ((LM_EMERGENCY, "SimpleAttributeHome_exec_i::create - "
                     "Test passed!  String attribute is %s\n",
                     this->str_.c_str ()));
      }

    ::Components::EnterpriseComponent_ptr retval =
      ::Components::EnterpriseComponent::_nil ();

    ACE_NEW_THROW_EX (
      retval,
      SimpleAttribute_exec_i,
      ::CORBA::NO_MEMORY ());

    return retval;
  }

  extern "C" SIMPLEATTRIBUTE_EXEC_Export ::Components::HomeExecutorBase_ptr
  create_Simple_SimpleAttributeHome_Impl (void)
  {
    ::Components::HomeExecutorBase_ptr retval =
      ::Components::HomeExecutorBase::_nil ();

    ACE_NEW_RETURN (
      retval,
      SimpleAttributeHome_exec_i,
      ::Components::HomeExecutorBase::_nil ());

    return retval;
  }
}