From 2f7819b18553115eb5422810abd3e37e9a57e93d Mon Sep 17 00:00:00 2001 From: "William R. Otte" Date: Thu, 16 Sep 2004 19:42:21 +0000 Subject: Thu Sep 16 14:41:08 2004 Will Otte ///and maps the values from the passed in XSC ///InstanceDeploymentDescription to its members. - void IDD_Handler::get_InstanceDeploymentDescription ( - Deployment::InstanceDeploymentDescription& toconfig, - InstanceDeploymentDescription& desc) + void + IDD_Handler::get_InstanceDeploymentDescription ( + Deployment::InstanceDeploymentDescription& toconfig, + InstanceDeploymentDescription& desc) { + // name, node, and source are required elements, + // and will be present in any valid instance document. + toconfig.name = CORBA::string_dup (desc.name ().c_str ()); + toconfig.node = CORBA::string_dup (desc.node ().c_str ()); + + toconfig.source.length (toconfig.source.length () + 1); + toconfig.source[toconfig.source.length () - 1] = + CORBA::string_dup (desc.source ().c_str ()); + + // @@TODO: What to do with the implementationRef? + + if (desc.configProperty_p ()) + { + // Create a property handler to fill in a property struct + Prop_Handler property_handler; + Deployment::Property prop; + property_handler.get_Property (prop, + desc.configProperty ()); + + // Make room in the sequence for the strtuct that we have + // created. + toconfig.configProperty.length (toconfig.configProperty.length () + 1); + toconfig.configProperty[toconfig.configProperty.length () - 1] = + prop; + } + if (desc.deployedResource_p ()) + { + CORBA::ULong length = toconfig.deployedResource.length (); + toconfig.deployedResource.length (length + 1); + + this->get_InstanceResourceDeploymentDescription + (toconfig.deployedResource[length - 1], + desc.deployedResource ()); + } + + if (desc.deployedSharedResource_p ()) + { + CORBA::ULong length = toconfig.deployedSharedResource.length (); + toconfig.deployedSharedResource.length (length + 1); + + this->get_InstanceResourceDeploymentDescription + (toconfig.deployedResource[length], + desc.deployedResource ()); + } + + // Done! + } + + void + IDD_Handler::get_InstanceResourceDeploymentDescription ( + Deployment::InstanceResourceDeploymentDescription &toconfig, + InstanceResourceDeploymentDescription &desc) + { + // resourceUsage is an enumerated type + switch (desc.resourceUsage ().integral ()) + { + case ResourceUsageKind::None_l: + toconfig.resourceUsage = Deployment::None; + break; + + case ResourceUsageKind::InstanceUsesResource_l: + toconfig.resourceUsage = Deployment::InstanceUsesResource; + break; + + case ResourceUsageKind::ResourceUsesInstance_l: + toconfig.resourceUsage = Deployment::ResourceUsesInstance; + break; + + case ResourceUsageKind::PortUsesResource_l: + toconfig.resourceUsage = Deployment::PortUsesResource; + break; + + case ResourceUsageKind::ResourceUsesPort_l: + toconfig.resourceUsage = Deployment::ResourceUsesPort; + break; + } + + // requirementName and resourceName are strings + toconfig.requirementName = + CORBA::string_dup (desc.requirementName ().c_str ()); + toconfig.resourceName = + CORBA::string_dup (desc.resourceName ().c_str ()); + + ANY_Handler::get_Any (toconfig.resourceValue, + desc.resourceValue ()); + + // Done! } } diff --git a/TAO/CIAO/DAnCE/Config_Handlers/IDD_Handler.h b/TAO/CIAO/DAnCE/Config_Handlers/IDD_Handler.h index 51a82f54bd9..3e8e28def0f 100644 --- a/TAO/CIAO/DAnCE/Config_Handlers/IDD_Handler.h +++ b/TAO/CIAO/DAnCE/Config_Handlers/IDD_Handler.h @@ -20,7 +20,8 @@ namespace Deployment { - struct InstanceDeploymentDescriptionn; + struct InstanceDeploymentDescription; + struct InstanceResourceDeploymentDescription; } namespace CIAO @@ -29,12 +30,13 @@ namespace CIAO namespace Config_Handlers { - struct InstanceDeploymentDescriptionn; + struct InstanceDeploymentDescription; + struct InstanceResourceDeploymentDescription; /* * @class IDD_Handler * - * @brief Handler class for types. + * @brief Handler class for types. * * This class defines handler methods to map values from * XSC InstanceDeploymentDescriptionn objects, parsed from @@ -42,7 +44,7 @@ namespace CIAO * */ - class Config_Handlers_Export IDD_Handler{ + class Config_Handlers_Export IDD_Handler { public: @@ -52,10 +54,15 @@ namespace CIAO ///This method takes a ///and maps the values from the passed in XSC ///InstanceDeploymentDescriptionn to its members. - void get_InstanceDeploymentDescriptionn ( - Deployment::InstanceDeploymentDescriptionn& toconfig, - InstanceDeploymentDescriptionn& desc); + void get_InstanceDeploymentDescription ( + Deployment::InstanceDeploymentDescription& toconfig, + InstanceDeploymentDescription& desc); + /// This method populates the Deployment::InstanceResourceDeploymentDescription + /// Which is inly used in the IDD above. + void get_InstanceResourceDeploymentDescription ( + Deployment::InstanceResourceDeploymentDescription &toconfig, + InstanceResourceDeploymentDescription &desc); }; } } -- cgit v1.2.1