summaryrefslogtreecommitdiff
path: root/modules/CIAO/tools/Config_Handlers/RT-CCM/PS_Handler.cpp
diff options
context:
space:
mode:
authorjai <jai@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2007-01-29 21:15:18 +0000
committerjai <jai@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2007-01-29 21:15:18 +0000
commitb71531b42b3325fd6079a7039aae8641262c8adf (patch)
treea5b9aa16924c541fcb424ee9460b1ac7f5a89352 /modules/CIAO/tools/Config_Handlers/RT-CCM/PS_Handler.cpp
parenta0f67cc97c0050d907145e312135b60c0125e56e (diff)
downloadATCD-b71531b42b3325fd6079a7039aae8641262c8adf.tar.gz
branching/taggingDS-main
Diffstat (limited to 'modules/CIAO/tools/Config_Handlers/RT-CCM/PS_Handler.cpp')
-rw-r--r--modules/CIAO/tools/Config_Handlers/RT-CCM/PS_Handler.cpp114
1 files changed, 114 insertions, 0 deletions
diff --git a/modules/CIAO/tools/Config_Handlers/RT-CCM/PS_Handler.cpp b/modules/CIAO/tools/Config_Handlers/RT-CCM/PS_Handler.cpp
new file mode 100644
index 00000000000..95c5bb76d9d
--- /dev/null
+++ b/modules/CIAO/tools/Config_Handlers/RT-CCM/PS_Handler.cpp
@@ -0,0 +1,114 @@
+// $Id$
+
+#include "PS_Handler.h"
+#include "PM_Handler.h"
+#include "CIAOServerResources.hpp"
+
+namespace CIAO
+{
+ namespace Config_Handlers
+ {
+ bool
+ PS_Handler::policy_set (const PolicySet &src,
+ ::CIAO::DAnCE::PolicySet &dest)
+ {
+ if (src.id_p ())
+ dest.Id = CORBA::string_dup (src.id ().c_str ());
+
+ // Make room for all of the policies
+ CORBA::ULong len (dest.policies.length ());
+ dest.policies.length (len +
+ src.count_priorityModel () +
+ src.count_threadpool () +
+ src.count_priorityBandedConnection ());
+
+ for (PolicySet::priorityModel_const_iterator i = src.begin_priorityModel ();
+ i != src.end_priorityModel ();
+ ++i)
+ {
+ ::CIAO::DAnCE::PriorityModelPolicyDef pmd;
+
+ PM_Handler::priority_model_pd (*i, pmd);
+
+ dest.policies[len++].PriorityModelDef (pmd);
+ }
+
+ for (PolicySet::threadpool_const_iterator i = src.begin_threadpool ();
+ i != src.end_threadpool ();
+ ++i)
+ {
+ ::CIAO::DAnCE::ThreadpoolPolicyDef tpd;
+
+ tpd.Id = CORBA::string_dup (i->id ().c_str ());
+
+ dest.policies[len++].ThreadpoolDef (tpd);
+ }
+
+
+ for (PolicySet::priorityBandedConnection_const_iterator i = src.begin_priorityBandedConnection ();
+ i != src.end_priorityBandedConnection ();
+ ++i)
+ {
+ ::CIAO::DAnCE::PriorityBandedConnectionPolicyDef pbc;
+
+ pbc.Id = CORBA::string_dup (i->id ().c_str ());
+
+ dest.policies[len++].PriorityBandedConnectionDef (pbc);
+ }
+
+
+
+ return true;
+ }
+
+
+ PolicySet
+ PS_Handler::policy_set (const ::CIAO::DAnCE::PolicySet &src)
+ {
+ PolicySet ps;
+
+ if (src.Id.in ())
+ ps.id (src.Id.in ());
+
+ for (CORBA::ULong i = 0;
+ i < src.policies.length ();
+ ++i)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "Attempting switch for i = %d\n",
+ i));
+
+ switch (src.policies[i]._d ())
+ {
+ case ::CIAO::DAnCE::PRIORITY_MODEL_POLICY_TYPE:
+ ps.add_priorityModel (
+ PM_Handler::priority_model_pd (src.policies[i].PriorityModelDef ()));
+ break;
+
+ case ::CIAO::DAnCE::THREADPOOL_POLICY_TYPE:
+ ps.add_threadpool (src.policies[i].ThreadpoolDef ().Id.in ());
+ break;
+
+ case ::CIAO::DAnCE::PRIORITY_BANDED_CONNECTION_POLICY_TYPE:
+ ps.add_priorityBandedConnection (src.policies[i].PriorityBandedConnectionDef ().Id.in ());
+ break;
+
+ case 0:
+ ACE_ERROR ((LM_ERROR,
+ "Skipping invalid policy.\n"));
+ break;
+
+ default:
+ ACE_ERROR ((LM_ERROR,
+ "Bad policy stored in policy_set: %i\n",
+ src.policies[i]._d ()));
+ throw 1;
+ }
+ }
+
+ return ps;
+ }
+
+ }
+
+}