Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / TAO / performance-tests / CSD_Strategy / TestInf / ServantList_T.cpp
blob8c8076e201cc47cd3894f9c5ea054b5a183b07b6
1 #include "ServantList_T.h"
2 #include "AppHelper.h"
3 #include "TestInf/TestAppExceptionC.h"
6 template <typename T>
7 ServantList<T>::ServantList()
12 template <typename T>
13 ServantList<T>::~ServantList()
18 template <typename T>
19 void
20 ServantList<T>::create_and_activate(unsigned num_servants,
21 CORBA::ORB_ptr orb,
22 PortableServer::POA_ptr poa,
23 const ACE_TCHAR* ior_fname_prefix)
25 for (unsigned i = 0; i < num_servants; i++)
27 ACE_TCHAR buf[32];
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");
30 ServantRecord record;
31 record.servant_ = new T();
32 record.safe_servant_ = record.servant_;
34 CORBA::Object_var obj
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);
52 template <typename T>
53 void
54 ServantList<T>::create_and_activate(unsigned num_servants,
55 PortableServer::POA_ptr poa)
57 for (unsigned i = 0; i < num_servants; i++)
59 ServantRecord record;
60 record.servant_ = new T();
61 record.safe_servant_ = record.servant_;
63 CORBA::Object_var obj
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);
79 template <typename T>
80 typename ServantList<T>::T_stub_ptr
81 ServantList<T>::objref(unsigned index)
83 return T_stub::_duplicate(this->servant_records_[index].obj_.in());
87 template <typename T>
89 ServantList<T>::servant(unsigned index)
91 return this->servant_records_[index].servant_;