Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / tests / Portable_Interceptors / PolicyFactory / PolicyFactory.cpp
blobcfb5b62333b55ea5ac6bb29b9ee4b03af568d310
1 #include "PolicyFactory.h"
2 #include "Policy.h"
4 CORBA::Policy_ptr
5 PolicyFactory::create_policy (CORBA::PolicyType type,
6 const CORBA::Any & value)
8 // Sanity check since this condition should be caught earlier by the
9 // TAO_PolicyFactory_Registry.
10 if (type != Test::POLICY_TYPE)
11 throw CORBA::PolicyError (CORBA::BAD_POLICY_TYPE);
13 CORBA::ULong val;
14 if (!(value >>= val))
15 throw CORBA::INTERNAL ();
17 Policy * p = 0;
18 ACE_NEW_THROW_EX (p,
19 Policy (val),
20 CORBA::NO_MEMORY ());
22 return p;