summaryrefslogtreecommitdiff
path: root/TAO/tao/BiDir_PolicyFactory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/tao/BiDir_PolicyFactory.cpp')
-rw-r--r--TAO/tao/BiDir_PolicyFactory.cpp47
1 files changed, 47 insertions, 0 deletions
diff --git a/TAO/tao/BiDir_PolicyFactory.cpp b/TAO/tao/BiDir_PolicyFactory.cpp
new file mode 100644
index 00000000000..25ee6789058
--- /dev/null
+++ b/TAO/tao/BiDir_PolicyFactory.cpp
@@ -0,0 +1,47 @@
+// -*- C++ -*-
+//
+// $Id$
+
+#include "tao/BiDir_PolicyFactory.h"
+#include "tao/BiDirPolicyC.h"
+#include "tao/BiDir_Policy_i.h"
+
+ACE_RCSID (tao, BiDir_PolicyFactory, "$Id$")
+
+
+
+
+CORBA::Policy_ptr
+TAO_BiDir_PolicyFactory::create_policy (
+ CORBA::PolicyType type,
+ const CORBA::Any &value
+ TAO_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ CORBA::PolicyError))
+{
+ CORBA::Policy_ptr policy = CORBA::Policy::_nil ();
+
+ TAO_ENV_ARG_DEFN;
+
+ if (type == BiDirPolicy::BIDIRECTIONAL_POLICY_TYPE)
+ {
+ BiDirPolicy::BidirectionalPolicyValue val;
+
+ // Extract the value from the any
+ value >>= val;
+
+ ACE_NEW_THROW_EX (policy,
+ TAO_BidirectionalPolicy (val),
+ CORBA::NO_MEMORY (
+ CORBA_SystemException::_tao_minor_code (
+ TAO_DEFAULT_MINOR_CODE,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ return policy;
+ }
+
+ ACE_THROW_RETURN (CORBA::PolicyError (CORBA::BAD_POLICY_TYPE),
+ CORBA::Policy::_nil ());
+}