blob: 18dc40e099509f262279205ba75168d00e395065 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
// -*- C++ -*-
// $Id$
#include "tao/BiDir_GIOP/BiDir_PolicyFactory.h"
#include "tao/BiDir_GIOP/BiDirGIOP.h"
#include "tao/BiDir_GIOP/BiDir_Policy_i.h"
#include "tao/ORB_Constants.h"
#include "tao/AnyTypeCode/Any.h"
#include "ace/CORBA_macros.h"
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
CORBA::Policy_ptr
TAO_BiDir_PolicyFactory::create_policy (
CORBA::PolicyType type,
const CORBA::Any &value)
{
CORBA::Policy_ptr policy = CORBA::Policy_ptr ();
if (type == BiDirPolicy::BIDIRECTIONAL_POLICY_TYPE)
{
BiDirPolicy::BidirectionalPolicyValue val;
// Extract the value from the any.
if ((value >>= val) == 0)
{
throw ::CORBA::PolicyError (CORBA::BAD_POLICY_VALUE);
}
ACE_NEW_THROW_EX (policy,
TAO_BidirectionalPolicy (val),
CORBA::NO_MEMORY (
CORBA::SystemException::_tao_minor_code (
TAO::VMCID,
ENOMEM),
CORBA::COMPLETED_NO));
return policy;
}
throw ::CORBA::PolicyError (CORBA::BAD_POLICY_TYPE);
}
TAO_END_VERSIONED_NAMESPACE_DECL
|