diff options
author | jules <jules@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2004-08-31 22:41:01 +0000 |
---|---|---|
committer | jules <jules@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2004-08-31 22:41:01 +0000 |
commit | 060b2a5f8136026a46d3fe21ce4398a4061131fa (patch) | |
tree | 5060ca0a6bf018a35821d73d857f013babdf1aee | |
parent | 48f5c1756c3f14273cf96e3802997b3616cac377 (diff) | |
download | ATCD-060b2a5f8136026a46d3fe21ce4398a4061131fa.tar.gz |
*** empty log message ***
-rw-r--r-- | TAO/CIAO/DAnCE/Config_Handlers/CID_Handler.cpp | 116 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/Config_Handlers/CPD_Handler.cpp | 29 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/Config_Handlers/Prop_Handler.cpp | 31 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/Config_Handlers/Prop_Handler.h | 60 |
4 files changed, 202 insertions, 34 deletions
diff --git a/TAO/CIAO/DAnCE/Config_Handlers/CID_Handler.cpp b/TAO/CIAO/DAnCE/Config_Handlers/CID_Handler.cpp index 20440307168..49ce5c7ac6f 100644 --- a/TAO/CIAO/DAnCE/Config_Handlers/CID_Handler.cpp +++ b/TAO/CIAO/DAnCE/Config_Handlers/CID_Handler.cpp @@ -1,6 +1,10 @@ // $Id$ #include "CID_Handler.h" +#include "Prop_Handler.h" +#include "CPD_Handler.h" + +typedef ::std::vector< ::CIAO::Config_Handlers::ComponentPortDescription >::iterator port_iterator; CIAO::Config_Handlers::CID_Handler::CID_Handler() {} @@ -12,35 +16,107 @@ CIAO::Config_Handlers::CID_Handler::get_ComponentInterfaceDescription (Deployment::ComponentInterfaceDescription& toconfig, ComponentInterfaceDescription& desc) { - - toconfig.UUID = - CORBA::string_dup (desc.UUID().c_str()); - toconfig.label = - CORBA::string_dup (desc.label().c_str()); - toconfig.specificType = - CORBA::string_dup (desc.specificType().c_str()); - - //Copy the values of the sequence types idlFile and - //supporteType to the - //<Deployment::ComponentInterfaceDescription>. - if(!desc.supportedType().empty()) + + //We first set up some of the basic + //properties such as UUID. We check + //to make sure each one is actually + //present before assigning it to + //the corresponding field in <toconfig>. + if( desc.UUID_p() ) { - toconfig.supportedType.length(1); - toconfig.supportedType[0] = - CORBA::string_dup(desc.supportedType().c_str()); + toconfig.UUID = + CORBA::string_dup (desc.UUID().c_str()); + } + if( desc.label_p() ){ + toconfig.label = + CORBA::string_dup (desc.label().c_str()); + } + if( desc.specificType_p() ){ + toconfig.specificType = + CORBA::string_dup (desc.specificType().c_str()); + } + + + if(desc.supportedType_p()){ + //Copy the values of the sequence types idlFile and + //supportedType to the + //<Deployment::ComponentInterfaceDescription>. + if(!desc.supportedType().empty()) + { + toconfig.supportedType.length (1); + toconfig.supportedType[0] = + CORBA::string_dup (desc.supportedType().c_str()); + } } - if(!desc.idlFile().empty()) + //Make sure the <idlFile> property + //is actually present before attempting + //any operations on it. + if(desc.idlFile_p () ){ + if(!desc.idlFile().empty()) + { + toconfig.idlFile.length (1); + toconfig.idlFile[0] = + CORBA::string_dup (desc.idlFile().c_str()); + } + } + + + Prop_Handler propertyhandler; + + //The IDL for the <configProperty> specifies + //a sequence of <Property> structs but the schema + //specifies <configProperty> as a single + //<Property>. We construct that single property + //element and assign it to the first position in the + //<configProperty> sequence. We only do this if it + //is present. + if(desc.configProperty_p () ) { - toconfig.idlFile.length(1); - toconfig.idlFile[0] = - CORBA::string_dup(desc.idlFile().c_str()); + //First construct the <Deployment::Property> + //to configure. + Deployment::Property prop; + + //Now, propogate the values from the <desc> into <prop>. + propertyhandler.get_Property (prop,desc.configProperty()); + + //Finally, add it to the sequence. + toconfig.configProperty.length (1); + toconfig.configProperty[0] = prop; } //Create the handler for the //<ComponentPortDescriptions>. - //CPDHandler cpd_handler(); + CPD_Handler cpd_handler; + //Iterate through each of the XSC Component + //Port Descriptions and use the CPD_Handler + //to propogate their values into the <port> + //sequence of <Deployment::ComponentInterfaceDescription> + for (ComponentInterfaceDescription::port_iterator + port (desc.begin_port ()); + port != desc.end_port (); + ++port) + { + toconfig.port.length (toconfig.port.length () + 1); + cpd_handler.get_ComponentPortDescription( + toconfig.port[toconfig.port.length () - 1], + *port); + } + + /*ComponentPropertyDescription stuff + * + * + * + * + * + */ + + + + + + return toconfig; diff --git a/TAO/CIAO/DAnCE/Config_Handlers/CPD_Handler.cpp b/TAO/CIAO/DAnCE/Config_Handlers/CPD_Handler.cpp index e028d5e3be1..a3f5aa695d9 100644 --- a/TAO/CIAO/DAnCE/Config_Handlers/CPD_Handler.cpp +++ b/TAO/CIAO/DAnCE/Config_Handlers/CPD_Handler.cpp @@ -4,7 +4,6 @@ #include "CPD_Handler.h" -using CIAO::Config_Handlers; CIAO::Config_Handlers::CPD_Handler::CPD_Handler() {} @@ -23,27 +22,29 @@ CIAO::Config_Handlers::CPD_Handler::get_ComponentPortDescription( { //We make sure that a value exists for supportedType //before increasing the size of the sequence. - if(!desc.supportedType().empty()){ + + if(!desc.supportedType().empty()) + { toconfig.supportedType.length(1); toconfig.supportedType[0] = CORBA::string_dup(desc.supportedType().c_str()); - } - - - toconfig.name = CORBA::string_dup(desc.name().c_str()); - - - toconfig.specificType = - CORBA::string_dup(desc.specificType().c_str()); + } + + + toconfig.name = CORBA::string_dup(desc.name().c_str()); + toconfig.specificType = + CORBA::string_dup(desc.specificType().c_str()); + //The DnC spec maps these CORBA IDL booleans to //strings. Therefore, we set them to true if a - //value was provided (they aren't an empty string) + //value was provided (and they aren't an empty string) //and false otherwise. - toconfig.provider = !desc.provider().empty(); + toconfig.provider = !desc.provider().empty(); toconfig.exclusiveProvider = !desc.exclusiveProvider().empty(); - toconfig.exclusiveUser = !desc.exclusiveUser().empty(); - toconfig.optional = !desc.optional().empty(); + toconfig.exclusiveUser = !desc.exclusiveUser().empty(); + toconfig.optional = !desc.optional().empty(); + //Return the Deployment::ComponentPortDescription return toconfig; diff --git a/TAO/CIAO/DAnCE/Config_Handlers/Prop_Handler.cpp b/TAO/CIAO/DAnCE/Config_Handlers/Prop_Handler.cpp new file mode 100644 index 00000000000..19adfe7285d --- /dev/null +++ b/TAO/CIAO/DAnCE/Config_Handlers/Prop_Handler.cpp @@ -0,0 +1,31 @@ +//$Id$ + +#include "Prop_Handler.h" +#include "ANY_Handler.h" + +CIAO::Config_Handlers::Prop_Handler::Prop_Handler() +{} +CIAO::Config_Handlers::Prop_Handler::~Prop_Handler() +{} + + +///This method maps the values from the +///XSC object <CIAO::Config_Handlers::Property> to +///the CORBA IDL type <Deployment::Property>. +Deployment::Property& +CIAO::Config_Handlers::Prop_Handler::get_Property( + Deployment::Property& toconfig, + Property& desc) +{ + toconfig.name = CORBA::string_dup (desc.name().c_str()); + + //Create the ANY_Handler to + //delegate the Any configuration + //to. + ANY_Handler anyhandler; + + //Delegate the Any configuration. + anyhandler.get_Any (toconfig.value, desc.value()); + + return toconfig; +} diff --git a/TAO/CIAO/DAnCE/Config_Handlers/Prop_Handler.h b/TAO/CIAO/DAnCE/Config_Handlers/Prop_Handler.h new file mode 100644 index 00000000000..ee3c9ac2ff0 --- /dev/null +++ b/TAO/CIAO/DAnCE/Config_Handlers/Prop_Handler.h @@ -0,0 +1,60 @@ +//================================================ +/** + * @file Prop_Handler.h + * + * $Id$ + * + * @author Jules White <jules@dre.vanderbilt.edu> + */ +//================================================ + +#ifndef PROP_HANDLER_H +#define PROP_HANDLER_H + +#include /**/ "ace/pre.h" + +#include "ciao/DeploymentC.h" +#include "Basic_Deployment_Data.hpp" + + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + + +namespace CIAO{ + + namespace Config_Handlers{ + + /* + * @class Prop_Handler + * + * @brief Handler class for <CCMComponentPortDescription> types. + * + * This class defines handler methods to map values from + * XSC objects, parsed from the descriptor files, to the + * corresponding CORBA IDL type for the schema element. + * + */ + + class Prop_Handler{ + + public: + + Prop_Handler(); + virtual ~Prop_Handler(); + + ///This method maps the values from the + ///XSC object <CIAO::Config_Handlers::Property> to + ///the CORBA IDL type <Deployment::Property>. + Deployment::Property& + get_Property( + Deployment::Property& toconfig, + Property& desc); + }; + + } +} + +#include /**/ "ace/post.h" +#endif /* PROP_HANDLER_H */ |