1 #include "ServantList_T.h"
3 #include "TestInf/TestAppExceptionC.h"
7 ServantList
<T
>::ServantList()
13 ServantList
<T
>::~ServantList()
20 ServantList
<T
>::create_and_activate(unsigned num_servants
,
22 PortableServer::POA_ptr poa
,
23 const ACE_TCHAR
* ior_fname_prefix
)
25 for (unsigned i
= 0; i
< num_servants
; i
++)
28 ACE_OS::sprintf(buf
, ACE_TEXT("%02d"), i
+ 1);
29 ACE_TString filename
= ACE_TString(ior_fname_prefix
) + ACE_TEXT("_") + buf
+ ACE_TEXT(".ior");
31 record
.servant_
= new T();
32 record
.safe_servant_
= record
.servant_
;
35 = AppHelper::activate_servant(poa
,
36 record
.safe_servant_
.in());
38 AppHelper::ref_to_file(orb
, obj
.in(), filename
.c_str());
40 record
.obj_
= T_stub::_narrow(obj
.in());
42 if (CORBA::is_nil(record
.obj_
.in()))
44 throw TestAppException();
47 this->servant_records_
.push_back(record
);
54 ServantList
<T
>::create_and_activate(unsigned num_servants
,
55 PortableServer::POA_ptr poa
)
57 for (unsigned i
= 0; i
< num_servants
; i
++)
60 record
.servant_
= new T();
61 record
.safe_servant_
= record
.servant_
;
64 = AppHelper::activate_servant(poa
,
65 record
.safe_servant_
.in());
67 record
.obj_
= T_stub::_narrow(obj
.in());
69 if (CORBA::is_nil(record
.obj_
.in()))
71 throw TestAppException();
74 this->servant_records_
.push_back(record
);
80 typename ServantList
<T
>::T_stub_ptr
81 ServantList
<T
>::objref(unsigned index
)
83 return T_stub::_duplicate(this->servant_records_
[index
].obj_
.in());
89 ServantList
<T
>::servant(unsigned index
)
91 return this->servant_records_
[index
].servant_
;