1 #include "tao/DiffServPolicy/Server_Network_Priority_Policy.h"
2 #include "tao/SystemException.h"
3 #include "tao/ORB_Constants.h"
6 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
8 TAO_Server_Network_Priority_Policy::TAO_Server_Network_Priority_Policy ()
11 , TAO::NetworkPriorityPolicy ()
12 , ::CORBA::LocalObject ()
13 , request_diffserv_codepoint_ (0)
14 , reply_diffserv_codepoint_ (0)
15 , network_priority_model_ (TAO::NO_NETWORK_PRIORITY
)
19 TAO_Server_Network_Priority_Policy::~TAO_Server_Network_Priority_Policy ()
23 TAO_Server_Network_Priority_Policy::TAO_Server_Network_Priority_Policy (
24 const TAO::DiffservCodepoint
&request_diffserv_codepoint
,
25 const TAO::DiffservCodepoint
&reply_diffserv_codepoint
,
26 TAO::NetworkPriorityModel
&network_priority_model
)
29 , TAO::NetworkPriorityPolicy ()
30 , ::CORBA::LocalObject ()
31 , request_diffserv_codepoint_ (request_diffserv_codepoint
)
32 , reply_diffserv_codepoint_ (reply_diffserv_codepoint
)
33 , network_priority_model_ (network_priority_model
)
37 TAO_Server_Network_Priority_Policy::TAO_Server_Network_Priority_Policy (
38 const TAO_Server_Network_Priority_Policy
&rhs
)
41 , TAO::NetworkPriorityPolicy ()
42 , ::CORBA::LocalObject ()
43 , request_diffserv_codepoint_ (rhs
.request_diffserv_codepoint_
)
44 , reply_diffserv_codepoint_ (rhs
.reply_diffserv_codepoint_
)
45 , network_priority_model_ (rhs
.network_priority_model_
)
50 TAO_Server_Network_Priority_Policy::create (const CORBA::Any
&)
52 CORBA::Policy_ptr policy
= CORBA::Policy::_nil ();
54 ACE_NEW_THROW_EX (policy
,
55 TAO_Server_Network_Priority_Policy (),
56 CORBA::NO_MEMORY (TAO::VMCID
,
57 CORBA::COMPLETED_NO
));
62 TAO_Server_Network_Priority_Policy::policy_type ()
64 return TAO::NETWORK_PRIORITY_TYPE
;
67 TAO_Server_Network_Priority_Policy
*
68 TAO_Server_Network_Priority_Policy::clone () const
70 TAO_Server_Network_Priority_Policy
*copy
= 0;
72 TAO_Server_Network_Priority_Policy (*this),
77 TAO::DiffservCodepoint
78 TAO_Server_Network_Priority_Policy::request_diffserv_codepoint ()
80 return this->request_diffserv_codepoint_
;
84 TAO_Server_Network_Priority_Policy::request_diffserv_codepoint (
85 TAO::DiffservCodepoint req_dscp
)
87 this->request_diffserv_codepoint_
= req_dscp
;
90 TAO::DiffservCodepoint
91 TAO_Server_Network_Priority_Policy::reply_diffserv_codepoint ()
93 return this->reply_diffserv_codepoint_
;
97 TAO_Server_Network_Priority_Policy::reply_diffserv_codepoint (
98 TAO::DiffservCodepoint reply_dscp
)
100 this->reply_diffserv_codepoint_
= reply_dscp
;
103 TAO::NetworkPriorityModel
104 TAO_Server_Network_Priority_Policy::network_priority_model ()
106 return this->network_priority_model_
;
110 TAO_Server_Network_Priority_Policy::network_priority_model (
111 TAO::NetworkPriorityModel npm
)
113 this->network_priority_model_
= npm
;
117 TAO_Server_Network_Priority_Policy::copy ()
119 TAO_Server_Network_Priority_Policy
* servant
= 0;
120 ACE_NEW_THROW_EX (servant
,
121 TAO_Server_Network_Priority_Policy (*this),
122 CORBA::NO_MEMORY ());
128 TAO_Server_Network_Priority_Policy::destroy ()
132 TAO_Cached_Policy_Type
133 TAO_Server_Network_Priority_Policy::_tao_cached_type () const
135 return TAO_CACHED_POLICY_NETWORK_PRIORITY
;
139 TAO_Server_Network_Priority_Policy::_tao_scope () const
141 return static_cast<TAO_Policy_Scope
> (TAO_POLICY_DEFAULT_SCOPE
|
142 TAO_POLICY_CLIENT_EXPOSED
);
146 TAO_Server_Network_Priority_Policy::_tao_encode (TAO_OutputCDR
&out_cdr
)
148 return ((out_cdr
<< request_diffserv_codepoint_
) &&
149 (out_cdr
<< reply_diffserv_codepoint_
) &&
150 (out_cdr
<< network_priority_model_
));
154 TAO_Server_Network_Priority_Policy::_tao_decode (TAO_InputCDR
&in_cdr
)
156 return ((in_cdr
>> request_diffserv_codepoint_
) &&
157 (in_cdr
>> reply_diffserv_codepoint_
) &&
158 (in_cdr
>> network_priority_model_
));
161 TAO_END_VERSIONED_NAMESPACE_DECL