POA_Cached_Policies.cpp

Go to the documentation of this file.
00001 // $Id: POA_Cached_Policies.cpp 77177 2007-02-16 17:01:50Z jai $
00002 
00003 #include "tao/PortableServer/POA_Cached_Policies.h"
00004 #include "tao/PortableServer/POA_Policy_Set.h"
00005 #include "tao/PortableServer/IdAssignmentPolicyC.h"
00006 #include "tao/PortableServer/IdUniquenessPolicyC.h"
00007 #include "tao/PortableServer/ImplicitActivationPolicyC.h"
00008 #include "tao/PortableServer/LifespanPolicyC.h"
00009 #include "tao/PortableServer/RequestProcessingPolicyC.h"
00010 #include "tao/PortableServer/ServantRetentionPolicyC.h"
00011 #include "tao/PortableServer/ThreadPolicyC.h"
00012 
00013 #if !defined (__ACE_INLINE__)
00014 # include "tao/PortableServer/POA_Cached_Policies.inl"
00015 #endif /* ! __ACE_INLINE__ */
00016 
00017 ACE_RCSID(PortableServer,
00018           POA_Cached_Policies,
00019           "$Id: POA_Cached_Policies.cpp 77177 2007-02-16 17:01:50Z jai $")
00020 
00021 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00022 
00023 namespace TAO
00024 {
00025   namespace Portable_Server
00026   {
00027     Cached_Policies::Cached_Policies () :
00028         thread_ (::PortableServer::ORB_CTRL_MODEL),
00029         lifespan_ (::PortableServer::TRANSIENT),
00030         id_uniqueness_ (::PortableServer::UNIQUE_ID),
00031         id_assignment_ (::PortableServer::SYSTEM_ID),
00032         implicit_activation_ (::PortableServer::NO_IMPLICIT_ACTIVATION),
00033         servant_retention_ (::PortableServer::RETAIN),
00034         request_processing_ (::PortableServer::USE_ACTIVE_OBJECT_MAP_ONLY),
00035         priority_model_ (Cached_Policies::NOT_SPECIFIED),
00036         server_priority_ (TAO_INVALID_PRIORITY),
00037         network_priority_model_ (Cached_Policies::NO_NETWORK_PRIORITY),
00038         request_diffserv_codepoint_ (0),
00039         reply_diffserv_codepoint_ (0)
00040     {
00041     }
00042 
00043 
00044     Cached_Policies::~Cached_Policies (void)
00045     {
00046     }
00047 
00048     void
00049     Cached_Policies::update (TAO_POA_Policy_Set &policy_set
00050                                      )
00051     {
00052       for (CORBA::ULong i = 0; i < policy_set.num_policies (); i++)
00053         {
00054           CORBA::Policy_var policy = policy_set.get_policy_by_index (i);
00055 
00056           this->update_policy (policy.in ()
00057                               );
00058         }
00059     }
00060 
00061     void
00062     Cached_Policies::update_policy (const CORBA::Policy_ptr policy
00063                                     )
00064     {
00065 
00066     #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
00067       ::PortableServer::ThreadPolicy_var thread
00068         = ::PortableServer::ThreadPolicy::_narrow (policy
00069                                                   );
00070 
00071       if (!CORBA::is_nil (thread.in ()))
00072         {
00073           this->thread_ = thread->value ();
00074 
00075           return;
00076         }
00077     #endif /* TAO_HAS_MINIMUM_POA == 0 */
00078 
00079     #if !defined (CORBA_E_MICRO)
00080       ::PortableServer::LifespanPolicy_var lifespan
00081         = ::PortableServer::LifespanPolicy::_narrow (policy
00082                                                     );
00083 
00084       if (!CORBA::is_nil (lifespan.in ()))
00085         {
00086           this->lifespan_ = lifespan->value ();
00087 
00088           return;
00089         }
00090     #endif
00091 
00092     #if !defined (CORBA_E_MICRO)
00093       ::PortableServer::IdUniquenessPolicy_var id_uniqueness
00094         = ::PortableServer::IdUniquenessPolicy::_narrow (policy
00095                                                         );
00096 
00097       if (!CORBA::is_nil (id_uniqueness.in ()))
00098         {
00099           this->id_uniqueness_ = id_uniqueness->value ();
00100 
00101           return;
00102         }
00103     #endif
00104 
00105     #if !defined (CORBA_E_MICRO)
00106       ::PortableServer::IdAssignmentPolicy_var id_assignment
00107         = ::PortableServer::IdAssignmentPolicy::_narrow (policy
00108                                                         );
00109 
00110       if (!CORBA::is_nil (id_assignment.in ()))
00111         {
00112           this->id_assignment_ = id_assignment->value ();
00113 
00114           return;
00115         }
00116     #endif
00117 
00118     #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
00119 
00120       ::PortableServer::ImplicitActivationPolicy_var implicit_activation
00121         = ::PortableServer::ImplicitActivationPolicy::_narrow (policy
00122                                                               );
00123 
00124       if (!CORBA::is_nil (implicit_activation.in ()))
00125         {
00126           this->implicit_activation_ = implicit_activation->value ();
00127 
00128           return;
00129         }
00130 
00131       ::PortableServer::ServantRetentionPolicy_var servant_retention
00132         = ::PortableServer::ServantRetentionPolicy::_narrow (policy
00133                                                             );
00134 
00135       if (!CORBA::is_nil (servant_retention.in ()))
00136         {
00137           this->servant_retention_ = servant_retention->value ();
00138 
00139           return;
00140         }
00141 
00142       ::PortableServer::RequestProcessingPolicy_var request_processing
00143         = ::PortableServer::RequestProcessingPolicy::_narrow (policy
00144                                                              );
00145 
00146       if (!CORBA::is_nil (request_processing.in ()))
00147         {
00148           this->request_processing_ = request_processing->value ();
00149 
00150           return;
00151         }
00152 
00153     #endif /* TAO_HAS_MINIMUM_POA == 0 */
00154 
00155     #if defined (CORBA_E_MICRO)
00156       ACE_UNUSED_ARG (policy);
00157     #endif
00158     }
00159   }
00160 }
00161 
00162 TAO_END_VERSIONED_NAMESPACE_DECL

Generated on Tue Feb 2 17:40:54 2010 for TAO_PortableServer by  doxygen 1.4.7