diff options
author | William R. Otte <wotte@dre.vanderbilt.edu> | 2004-09-16 19:42:21 +0000 |
---|---|---|
committer | William R. Otte <wotte@dre.vanderbilt.edu> | 2004-09-16 19:42:21 +0000 |
commit | 2f7819b18553115eb5422810abd3e37e9a57e93d (patch) | |
tree | eecec45da5f1983ca2b4eedb616d535a83613fbc | |
parent | 948617236b677d7aadf3213a04beda76420fb4bf (diff) | |
download | ATCD-2f7819b18553115eb5422810abd3e37e9a57e93d.tar.gz |
Thu Sep 16 14:41:08 2004 Will Otte <wotte@dre.vanderbilt.edu
-rw-r--r-- | TAO/CIAO/DAnCE/Config_Handlers/Config_Handlers_export.h | 58 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/Config_Handlers/IDD_Handler.cpp | 96 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/Config_Handlers/IDD_Handler.h | 21 |
3 files changed, 165 insertions, 10 deletions
diff --git a/TAO/CIAO/DAnCE/Config_Handlers/Config_Handlers_export.h b/TAO/CIAO/DAnCE/Config_Handlers/Config_Handlers_export.h new file mode 100644 index 00000000000..64dec8bdfa5 --- /dev/null +++ b/TAO/CIAO/DAnCE/Config_Handlers/Config_Handlers_export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl -s Config_Handlers +// ------------------------------ +#ifndef CONFIG_HANDLERS_EXPORT_H +#define CONFIG_HANDLERS_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (CONFIG_HANDLERS_HAS_DLL) +# define CONFIG_HANDLERS_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && CONFIG_HANDLERS_HAS_DLL */ + +#if !defined (CONFIG_HANDLERS_HAS_DLL) +# define CONFIG_HANDLERS_HAS_DLL 1 +#endif /* ! CONFIG_HANDLERS_HAS_DLL */ + +#if defined (CONFIG_HANDLERS_HAS_DLL) && (CONFIG_HANDLERS_HAS_DLL == 1) +# if defined (CONFIG_HANDLERS_BUILD_DLL) +# define Config_Handlers_Export ACE_Proper_Export_Flag +# define CONFIG_HANDLERS_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define CONFIG_HANDLERS_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* CONFIG_HANDLERS_BUILD_DLL */ +# define Config_Handlers_Export ACE_Proper_Import_Flag +# define CONFIG_HANDLERS_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define CONFIG_HANDLERS_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* CONFIG_HANDLERS_BUILD_DLL */ +#else /* CONFIG_HANDLERS_HAS_DLL == 1 */ +# define Config_Handlers_Export +# define CONFIG_HANDLERS_SINGLETON_DECLARATION(T) +# define CONFIG_HANDLERS_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* CONFIG_HANDLERS_HAS_DLL == 1 */ + +// Set CONFIG_HANDLERS_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (CONFIG_HANDLERS_NTRACE) +# if (ACE_NTRACE == 1) +# define CONFIG_HANDLERS_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define CONFIG_HANDLERS_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !CONFIG_HANDLERS_NTRACE */ + +#if (CONFIG_HANDLERS_NTRACE == 1) +# define CONFIG_HANDLERS_TRACE(X) +#else /* (CONFIG_HANDLERS_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define CONFIG_HANDLERS_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (CONFIG_HANDLERS_NTRACE == 1) */ + +#endif /* CONFIG_HANDLERS_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/CIAO/DAnCE/Config_Handlers/IDD_Handler.cpp b/TAO/CIAO/DAnCE/Config_Handlers/IDD_Handler.cpp index dcee5b2190c..0d60bc4ba26 100644 --- a/TAO/CIAO/DAnCE/Config_Handlers/IDD_Handler.cpp +++ b/TAO/CIAO/DAnCE/Config_Handlers/IDD_Handler.cpp @@ -1,6 +1,8 @@ // $Id$ #include "IDD_Handler.h" +#include "Prop_Handler.h" +#include "ANY_Handler.h" #include "Basic_Deployment_Data.hpp" #include "ciao/Deployment_DataC.h" @@ -20,11 +22,99 @@ namespace CIAO ///This method takes a <Deployment::InstanceDeploymentDescription> ///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 <InstanceDeploymentDescriptionn> types. + * @brief Handler class for <InstanceDeploymentDescription> 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 <Deployment::InstanceDeploymentDescriptionn> ///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); }; } } |