#include #include "poautil.h" PortableServer::POA_ptr POAUtil::create_basic_POA( PortableServer::POA_ptr parentPOA, PortableServer::POAManager_ptr POAManager, char * POAName, CORBA::Boolean isMultiThread, CORBA::Boolean isPersistent) { CORBA::PolicyList policies; policies.length(3); CORBA::ULong i = 0; PortableServer::ThreadPolicyValue threadPolicy; if (isMultiThread) { threadPolicy = PortableServer::ORB_CTRL_MODEL; } else { threadPolicy = PortableServer::SINGLE_THREAD_MODEL; } policies[i] = parentPOA->create_thread_policy(threadPolicy); PortableServer::LifespanPolicyValue lifespanPolicy; PortableServer::IdAssignmentPolicyValue idAssignPolicy; if (isPersistent) { lifespanPolicy = PortableServer::PERSISTENT; idAssignPolicy = PortableServer::USER_ID; } else { lifespanPolicy = PortableServer::TRANSIENT; idAssignPolicy = PortableServer::SYSTEM_ID; } policies[++i] = parentPOA->create_lifespan_policy(lifespanPolicy); policies[++i] = parentPOA->create_id_assignment_policy(idAssignPolicy); return parentPOA->create_POA(POAName, POAManager, policies); }