PI_PolicyFactory.cpp

Go to the documentation of this file.
00001 #include "tao/PI/PI_PolicyFactory.h"
00002 
00003 #if TAO_HAS_INTERCEPTORS == 1
00004 
00005 #include "tao/PI/ProcessingModePolicy.h"
00006 #include "tao/ORB_Constants.h"
00007 #include "tao/SystemException.h"
00008 #include "ace/CORBA_macros.h"
00009 
00010 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00011 
00012 ACE_RCSID (tao,
00013            PI_PolicyFactory,
00014            "$Id: PI_PolicyFactory.cpp 76995 2007-02-11 12:51:42Z johnnyw $")
00015 
00016 CORBA::Policy_ptr
00017 TAO_PI_PolicyFactory::create_policy (
00018     CORBA::PolicyType type,
00019     const CORBA::Any &value)
00020 {
00021   if (type == PortableInterceptor::PROCESSING_MODE_POLICY_TYPE)
00022     {
00023       TAO_ProcessingModePolicy *processing_mode_policy = 0;
00024       PortableInterceptor::ProcessingMode policy_value;
00025 
00026       if ((value >>= policy_value) == 0)
00027         {
00028           throw ::CORBA::PolicyError (CORBA::BAD_POLICY_VALUE);
00029         }
00030 
00031       ACE_NEW_THROW_EX (processing_mode_policy,
00032                         TAO_ProcessingModePolicy (policy_value),
00033                         CORBA::NO_MEMORY (TAO::VMCID,
00034                                           CORBA::COMPLETED_NO));
00035 
00036       return processing_mode_policy;
00037     }
00038 
00039   throw ::CORBA::PolicyError (CORBA::BAD_POLICY_TYPE);
00040 }
00041 
00042 TAO_END_VERSIONED_NAMESPACE_DECL
00043 
00044 #endif  /* TAO_HAS_INTERCEPTORS == 1 */

Generated on Tue Feb 2 17:42:01 2010 for TAO_PI by  doxygen 1.4.7