Revert "Minor modernization of DynamicAny code"
[ACE_TAO.git] / TAO / tao / CSD_Framework / CSD_Strategy_Proxy.h
blob37a56cbd633a93d20fb1ff96fae93003ab172e1e
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file CSD_Strategy_Proxy.h
7 * @author Tim Bradley <bradley_t@ociweb.com>
8 */
9 //=============================================================================
11 #ifndef TAO_SERVANT_DISPATCHING_STRATEGY_PROXY_H
12 #define TAO_SERVANT_DISPATCHING_STRATEGY_PROXY_H
14 #include /**/ "ace/pre.h"
16 #include "tao/CSD_Framework/CSD_FW_Export.h"
18 #include "tao/PortableServer/PortableServer.h"
19 #include "tao/PortableServer/Servant_Upcall.h"
21 #if !defined (ACE_LACKS_PRAGMA_ONCE)
22 # pragma once
23 #endif /* ACE_LACKS_PRAGMA_ONCE */
25 #include "tao/CSD_Framework/CSD_Strategy_Base.h"
28 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
30 class TAO_ServerRequest;
32 namespace TAO
34 namespace CSD
36 /**
37 * @class Strategy_Proxy
39 * @brief Proxy class for the Custom Servant Dispatching Strategy.
41 * If no custom servant dispatching strategy is provided to the proxy,
42 * then the "default servant dispatching strategy" logic is used.
44 class TAO_CSD_FW_Export Strategy_Proxy
46 public:
47 /// Default Constructor.
48 Strategy_Proxy();
50 /// Destructor.
51 ~Strategy_Proxy();
53 /// Mutator to provide the proxy with a CSD Strategy object.
54 /// A return value of true indicates success, and false indicates
55 /// failure to set the custom strategy on the proxy object.
56 bool custom_strategy(CSD_Framework::Strategy_ptr strategy);
58 /// Invoked by the Object_Adapter using an ORB thread.
59 ///
60 /// If the proxy object holds a custom strategy object, then this method
61 /// will simply delegate to the custom strategy object. Otherwise,
62 /// this method will perform the "default servant dispatching strategy"
63 /// logic, preserving the original logic path as it was prior to the
64 /// introduction of the Custom Servant Dispatching feature.
65 ///
66 /// This method will be inlined (if inlining is turned on during the build).
67 ///
68 /// The added cost to the original logic path will be this method
69 /// invocation + one conditional (an is_nil() call/comparison for truth on
70 /// the smart pointer to the custom dispatching strategy object).
71 void dispatch_request(TAO_ServerRequest& server_request,
72 TAO::Portable_Server::Servant_Upcall& upcall);
75 /// Event - The POA has been (or is being) activated.
76 bool poa_activated_event(TAO_ORB_Core& orb_core);
78 /// Event - The POA has been deactivated.
79 void poa_deactivated_event();
81 /// Event - A servant has been activated.
82 void servant_activated_event(PortableServer::Servant servant,
83 const PortableServer::ObjectId& oid);
85 /// Event - A servant has been deactivated.
86 void servant_deactivated_event(PortableServer::Servant servant,
87 const PortableServer::ObjectId& oid);
89 private:
90 /// Smart Pointer to a custom servant dispatching strategy object.
91 /// This smart pointer will be in the "nil" state when the "default"
92 /// strategy is to be applied.
93 CSD_Framework::Strategy_var strategy_;
94 TAO::CSD::Strategy_Base *strategy_impl_;
99 TAO_END_VERSIONED_NAMESPACE_DECL
101 #if defined (__ACE_INLINE__)
102 # include "tao/CSD_Framework/CSD_Strategy_Proxy.inl"
103 #endif /* __ACE_INLINE__ */
105 #include /**/ "ace/post.h"
107 #endif