diff options
Diffstat (limited to 'CIAO/tools/Config_Handlers/Req_Handler.cpp')
-rw-r--r-- | CIAO/tools/Config_Handlers/Req_Handler.cpp | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/CIAO/tools/Config_Handlers/Req_Handler.cpp b/CIAO/tools/Config_Handlers/Req_Handler.cpp new file mode 100644 index 00000000000..76d0d5b7791 --- /dev/null +++ b/CIAO/tools/Config_Handlers/Req_Handler.cpp @@ -0,0 +1,57 @@ +// $Id$ + +#include "Req_Handler.h" +#include "Property_Handler.h" +#include "DAnCE/Deployment/DeploymentC.h" +#include "ciao/CIAO_common.h" +namespace CIAO +{ + namespace Config_Handlers + { + + Req_Handler::Req_Handler (void) + { + } + + Req_Handler::~Req_Handler (void) + { + } + + void + Req_Handler::handle_requirement (const Requirement& desc, + Deployment::Requirement& toconfig) + { + CIAO_TRACE("Req_Handler::get_Requirement"); + + //Map the basic string types to their Deployment::Req + //counterparts. + toconfig.name = desc.name ().c_str (); + toconfig.resourceType = desc.resourceType ().c_str (); + + toconfig.property.length (desc.count_property ()); + std::for_each (desc.begin_property (), + desc.end_property (), + Property_Functor (toconfig.property)); + } + + Requirement + Req_Handler::get_requirement (const Deployment::Requirement& src) + { + CIAO_TRACE("Req_Handler::get_requirement - reverse"); + + //Get the values for name and res + XMLSchema::string< char > name ((src.name)); + XMLSchema::string< char > res ((src.resourceType)); + + //Instantiate the Requirement + Requirement req (name,res); + + for (CORBA::ULong i = 0; i < src.property.length (); ++i) + { + req.add_property (Property_Handler::get_property (src.property[i])); + } + + return req; + } + } +} |