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
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
|
// $Id$
//
// **** Code generated by the ****
// **** Component Integrated ACE ORB (CIAO) CIDL Compiler ****
// CIAO has been developed by:
// Center for Distributed Object Computing
// Washington University
// St. Louis, MO
// USA
// http://www.cs.wustl.edu/~schmidt/doc-center.html
// CIDL Compiler has been developed by:
// Institute for Software Integrated Systems
// Vanderbilt University
// Nashville, TN
// USA
// http://www.isis.vanderbilt.edu/
//
// Information about CIAO is available at:
// http://www.dre.vanderbilt.edu/CIAO
#include "SimpleFT_exec.h"
#include <ace/Env_Value_T.h>
#include <orbsvcs/CosNamingC.h>
#include "ciao/CIAO_common.h"
#include "ciao/Containers/Container_Base.h"
#include "ciao/Contexts/Context_Impl_Base.h"
namespace CIDL_SimpleFT_Impl
{
//==================================================================
// Component Executor Implementation Class: SimpleFT_exec_i
//==================================================================
SimpleFT_exec_i::SimpleFT_exec_i (void)
{
CIAO_TRACE ("SimpleFT_exec_i::SimpleFT_exec_i (void)");
CIAO_DEBUG ((LM_EMERGENCY, "SimpleFT - Test - Lifecycle event - SimpleFT_exec_i::SimpleFT_exec_i (void)\n"));
}
SimpleFT_exec_i::~SimpleFT_exec_i (void)
{
CIAO_TRACE ("SimpleFT_exec_i::~SimpleFT_exec_i");
CIAO_DEBUG ((LM_EMERGENCY, "SimpleFT - Test - Lifecycle event - SimpleFT_exec_i::~SimpleFT_exec_i\n"));
}
// Supported or inherited operations.
// Attribute operations.
// Port operations.
// Operations from Components::SessionComponent
void
SimpleFT_exec_i::set_session_context (
::Components::SessionContext_ptr ctx)
{
CIAO_TRACE ("SimpleFT_exec_i::set_session_context");
CIAO_DEBUG ((LM_EMERGENCY, "SimpleFT - Test - Lifecycle event - SimpleFT_exec_i::set_session_context\n"));
this->context_ =
::Simple::CCM_SimpleFT_Context::_narrow (ctx);
if (CORBA::is_nil (this->context_.in ()))
{
throw ::CORBA::INTERNAL ();
}
}
void
SimpleFT_exec_i::configuration_complete ()
{
CIAO_TRACE ("SimpleFT_exec_i::configuration_complete\n");
CIAO_DEBUG ((LM_EMERGENCY, "SimpleFT - Test - Lifecycle event - SimpleFT_exec_i::configuration_complete\n"));
// Your code here.
}
void
SimpleFT_exec_i::ccm_activate ()
{
CIAO_TRACE ("SimpleFT_exec_i::ccm_activate");
CIAO_DEBUG ((LM_EMERGENCY, "SimpleFT - Test - Lifecycle event - SimpleFT_exec_i::ccm_activate\n"));
CIAO_DEBUG ((LM_DEBUG, "resolving name service reference\n"));
#ifdef RESOLVE_INITIAL_REFERENCE_IS_IMPLEMENTED
CORBA::Object_var ns_obj = context_->resolve_service_reference ("NameService");
#else
std::string ns_ior = ACE_Env_Value <std::string> ("NameServiceIOR", std::string ());
if (ns_ior.empty ())
{
CIAO_ERROR ((LM_WARNING, "SimpleFT_exec_i::ccm_activate - could find NameServiceIOR env variable.\n"));
return;
}
#endif
#if 0
CIAO::Context_Impl_Base * base_context =
dynamic_cast <CIAO::Context_Impl_Base*> (context_.in ());
CORBA::Object_var ns_obj = base_context->_ciao_the_Container ()->the_ORB ()->string_to_object (ns_ior.c_str ());
CIAO_DEBUG ((LM_DEBUG, "narrowing name servic\n"));
CosNaming::NamingContextExt_var ns = CosNaming::NamingContextExt::_narrow (ns_obj.in ());
#endif
}
void
SimpleFT_exec_i::ccm_passivate ()
{
CIAO_TRACE ("SimpleFT_exec_i::ccm_passivate");
CIAO_DEBUG ((LM_EMERGENCY, "SimpleFT - Test - Lifecycle event - SimpleFT_exec_i::ccm_passivate\n"));
// Your code here.
}
void
SimpleFT_exec_i::ccm_remove ()
{
CIAO_TRACE ("SimpleFT_exec_i::ccm_remove");
CIAO_DEBUG ((LM_EMERGENCY, "SimpleFT - Test - Lifecycle event - SimpleFT_exec_i::ccm_remove\n"));
// Your code here.
}
//==================================================================
// Home Executor Implementation Class: SimpleFTHome_exec_i
//==================================================================
SimpleFTHome_exec_i::SimpleFTHome_exec_i (void)
{
CIAO_TRACE ("SimpleFTHome_exec_i::SimpleFTHome_exec_i");
CIAO_DEBUG ((LM_EMERGENCY, "SimpleFT - Test - Lifecycle event - SimpleFTHome_exec_i::SimpleFTHome_exec_i\n"));
}
SimpleFTHome_exec_i::~SimpleFTHome_exec_i (void)
{
CIAO_TRACE ("SimpleFTHome_exec_i::~SimpleFTHome_exec_i");
CIAO_DEBUG ((LM_EMERGENCY, "SimpleFT - Test - Lifecycle event - SimpleFTHome_exec_i::~SimpleFTHome_exec_i\n"));
}
// Supported or inherited operations.
void
SimpleFT_exec_i::set_state (const CORBA::Any & state_value)
{
// extract value to an intermediate long variable since it's not possible
// to extract to a long & directly
CORBA::Long value;
if (state_value >>= value)
state_ = value;
else
CIAO_DEBUG ((LM_WARNING,
"ReplicatedApplication_i::set_state () "
"could not extract satet value from Any."));
CIAO_DEBUG ((LM_TRACE, "test_i::set_state (%d) called.\n", value));
}
CORBA::Any *
SimpleFT_exec_i::get_state ()
{
// create new any object
CORBA::Any_var state (new CORBA::Any);
// create intermediate object with the value
CORBA::Long value = state_;
ACE_DEBUG ((LM_DEBUG, "test_i::get_state returns %d.\n", value));
// insert value into the any object
*state <<= value;
return state._retn ();
}
void
SimpleFT_exec_i::method (CORBA::ULong test_start, CORBA::ULong test_end,
CORBA::ULong work,
CORBA::ULong prime_number,
CORBA::ULong kill)
{
#ifdef JUST_COPIED
static int i = 0;
ACE_DEBUG ((LM_DEBUG, "%d\n",i++));
if (kill && stop_)
ACE_OS::exit (1);
if (test_start == 1)
{
this->start_ = ACE_OS::gethrtime ();
}
ACE_hrtime_t start = ACE_OS::gethrtime ();
for (; work != 0; work--)
ACE::is_prime (prime_number,
2,
prime_number / 2);
ACE_hrtime_t end = ACE_OS::gethrtime ();
++state_;
if (!CORBA::is_nil (agent_.in ()))
agent_->state_changed (object_id_.c_str ());
// ACE_DEBUG ((LM_DEBUG, "Time taken = %d\n", end - start));
this->history_.sample (end - start);
if (test_end == 1)
{
this->end_ = ACE_OS::gethrtime ();
}
#endif
}
void
SimpleFT_exec_i::dump (void)
{
#ifdef JUST_COPIED
ACE_UINT32 gsf = ACE_High_Res_Timer::global_scale_factor ();
ACE_Basic_Stats stats;
this->history_.collect_basic_stats (stats);
stats.dump_results ("Total", gsf);
ACE_Throughput_Stats::dump_throughput ("Total", gsf,
this->end_ - this->start_,
stats.samples_count ());
#endif
}
void
SimpleFT_exec_i::shutdown (void)
{
#ifdef JUST_COPIED
this->orb_->shutdown (0);
#endif
}
// Home operations.
// Factory and finder operations.
// Attribute operations.
// Implicit operations.
::Components::EnterpriseComponent_ptr
SimpleFTHome_exec_i::create ()
{
CIAO_TRACE ("SimpleFTHome_exec_i::create");
CIAO_DEBUG ((LM_EMERGENCY, "SimpleFT - Test - Lifecycle event - SimpleFTHome_exec_i::create\n"));
::Components::EnterpriseComponent_ptr retval =
::Components::EnterpriseComponent::_nil ();
ACE_NEW_THROW_EX (
retval,
SimpleFT_exec_i,
::CORBA::NO_MEMORY ());
return retval;
}
extern "C" SIMPLEFT_EXEC_Export ::Components::HomeExecutorBase_ptr
create_Simple_SimpleFTHome_Impl (void)
{
CIAO_TRACE ("create_Simple_SimpleFTHome_Impl");
CIAO_DEBUG ((LM_EMERGENCY, "SimpleFT - Test - Lifecycle event - create_Simple_SimpleFTHome_Impl\n"));
::Components::HomeExecutorBase_ptr retval =
::Components::HomeExecutorBase::_nil ();
ACE_NEW_RETURN (
retval,
SimpleFTHome_exec_i,
::Components::HomeExecutorBase::_nil ());
return retval;
}
}
|