2 #include "tao/Messaging/Messaging_PolicyFactory.h"
3 #include "tao/Messaging/Messaging_Policy_i.h"
4 #include "tao/Messaging/Connection_Timeout_Policy_i.h"
5 #include "tao/Messaging/Buffering_Constraint_Policy.h"
7 #include "tao/PolicyC.h"
8 #include "tao/AnyTypeCode/Any.h"
10 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
13 TAO_Messaging_PolicyFactory::create_policy (
14 CORBA::PolicyType type
,
15 const CORBA::Any
&value
)
17 #if (TAO_HAS_RELATIVE_ROUNDTRIP_TIMEOUT_POLICY == 1)
18 if (type
== Messaging::RELATIVE_RT_TIMEOUT_POLICY_TYPE
)
19 return TAO_RelativeRoundtripTimeoutPolicy::create (value
);
20 #endif /* TAO_HAS_RELATIVE_ROUNDTRIP_TIMEOUT_POLICY == 1 */
22 #if (TAO_HAS_CONNECTION_TIMEOUT_POLICY == 1)
23 if (type
== TAO::CONNECTION_TIMEOUT_POLICY_TYPE
)
24 return TAO_ConnectionTimeoutPolicy::create (value
);
25 #endif /* TAO_HAS_RELATIVE_ROUNDTRIP_TIMEOUT_POLICY == 1 */
27 #if (TAO_HAS_SYNC_SCOPE_POLICY == 1)
28 if (type
== Messaging::SYNC_SCOPE_POLICY_TYPE
)
29 return TAO_Sync_Scope_Policy::create (value
);
30 #endif /* TAO_HAS_SYNC_SCOPE_POLICY == 1 */
32 #if (TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1)
33 if (type
== TAO::BUFFERING_CONSTRAINT_POLICY_TYPE
)
34 return TAO_Buffering_Constraint_Policy::create (value
);
35 #endif /* TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1 */
38 #if (TAO_HAS_REBIND_POLICY == 1)
39 type
== Messaging::REBIND_POLICY_TYPE
||
40 #endif /* TAO_HAS_REBIND_POLICY == 1 */
41 #if (TAO_HAS_PRIORITY_POLICIES == 1)
42 type
== Messaging::REQUEST_PRIORITY_POLICY_TYPE
||
43 type
== Messaging::REPLY_PRIORITY_POLICY_TYPE
||
44 #endif /* TAO_HAS_PRIORITY_POLICIES == 1 */
45 #if (TAO_HAS_REQUEST_START_TIME_POLICY == 1)
46 type
== Messaging::REQUEST_START_TIME_POLICY_TYPE
||
47 #endif /* TAO_HAS_REQUEST_START_TIME_POLICY == 1 */
48 #if (TAO_HAS_REQUEST_END_TIME_POLICY == 1)
49 type
== Messaging::REQUEST_END_TIME_POLICY_TYPE
||
50 #endif /* TAO_HAS_REQUEST_END_TIME_POLICY == 1 */
51 #if (TAO_HAS_REPLY_START_TIME_POLICY == 1)
52 type
== Messaging::REPLY_START_TIME_POLICY_TYPE
||
53 #endif /* TAO_HAS_REPLY_START_TIME_POLICY == 1 */
54 #if (TAO_HAS_REPLY_END_TIME_POLICY == 1)
55 type
== Messaging::REPLY_END_TIME_POLICY_TYPE
||
56 #endif /* TAO_HAS_REPLY_END_TIME_POLICY == 1 */
57 #if (TAO_HAS_RELATIVE_REQUEST_TIMEOUT_POLICY == 1)
58 type
== Messaging::RELATIVE_REQ_TIMEOUT_POLICY_TYPE
||
59 #endif /* TAO_HAS_RELATIVE_REQUEST_TIMEOUT_POLICY == 1 */
60 #if (TAO_HAS_ROUTING_POLICY == 1)
61 type
== Messaging::ROUTING_POLICY_TYPE
||
62 #endif /* TAO_HAS_ROUTING_POLICY == 1 */
63 #if (TAO_HAS_MAX_HOPS_POLICY == 1)
64 type
== Messaging::MAX_HOPS_POLICY_TYPE
||
65 #endif /* TAO_HAS_MAX_HOPS_POLICY == 1 */
66 type
== Messaging::QUEUE_ORDER_POLICY_TYPE
)
67 throw ::CORBA::PolicyError (CORBA::UNSUPPORTED_POLICY
);
69 ACE_UNUSED_ARG (value
);
71 throw ::CORBA::PolicyError (CORBA::BAD_POLICY_TYPE
);
74 TAO_END_VERSIONED_NAMESPACE_DECL