From 4575aded9abae73ae8b5ad6afbabd9335a945589 Mon Sep 17 00:00:00 2001 From: "William R. Otte" Date: Wed, 22 Sep 2004 20:26:43 +0000 Subject: Wed Sep 22 15:25:33 2004 Will Otte --- TAO/CIAO/DAnCE/Config_Handlers/Base_Handler.cpp | 24 ++++++++- TAO/CIAO/DAnCE/Config_Handlers/Base_Handler.h | 66 +++++++++++++++---------- 2 files changed, 63 insertions(+), 27 deletions(-) diff --git a/TAO/CIAO/DAnCE/Config_Handlers/Base_Handler.cpp b/TAO/CIAO/DAnCE/Config_Handlers/Base_Handler.cpp index 268334452f3..3ab3d1bd6f8 100644 --- a/TAO/CIAO/DAnCE/Config_Handlers/Base_Handler.cpp +++ b/TAO/CIAO/DAnCE/Config_Handlers/Base_Handler.cpp @@ -1,7 +1,8 @@ // $Id$ #include "Base_Handler.h" - +#include "tao/CORBA_String.h" +#include "tao/StringSeqC.h" namespace CIAO { @@ -15,6 +16,27 @@ namespace CIAO Base_Handler::~Base_Handler (void) { } + + // This should probably be inline. + // Copies the string provided into the provided CORBA string. + void + Base_Handler::handle_string (const ::XMLSchema::string &str, + CORBA::String_var &tofill) + { + tofill = CORBA::string_dup (str.c_str ()); + } + + + /// Appends the string provided to the provided StringSeq. + void + Base_Handler::handle_string_seq (::XMLSchema::string &str, + CORBA::StringSeq &tofill) + { + tofill.length (tofill.length () + 1); + tofill[tofill.length () - 1] = + CORBA::string_dup (str.c_str ()); + } + /// The Deployment spec references elements by /// their position within their parent sequence. diff --git a/TAO/CIAO/DAnCE/Config_Handlers/Base_Handler.h b/TAO/CIAO/DAnCE/Config_Handlers/Base_Handler.h index 8736edec106..4d8d05fb09d 100644 --- a/TAO/CIAO/DAnCE/Config_Handlers/Base_Handler.h +++ b/TAO/CIAO/DAnCE/Config_Handlers/Base_Handler.h @@ -21,47 +21,61 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +namespace CORBA +{ + struct String_var; + struct StringSeq; +} + namespace CIAO { namespace Config_Handlers { - /* - * @class Base_Handler - * - * @brief base class for Type handlers. - * - * - * - */ + /* + * @class Base_Handler + * + * @brief base class for Type handlers. + * + * + * + */ class Config_Handlers_Export Base_Handler{ - public: + public: - typedef ACE_Hash_Map_Manager IDREF_MAP; + typedef ACE_Hash_Map_Manager IDREF_MAP; - Base_Handler (void); - virtual ~Base_Handler (void); - - /// The Deployment spec references elements by - /// their position within their parent sequence. - /// These two methods allow an element's index - /// to be stored/retrieved. + Base_Handler (void); + virtual ~Base_Handler (void); + + /// Populates a CORBA string with the provided XMLString. + void handle_string (const ::XMLSchema::string &str, + CORBA::String_var &tofill); + + /// Appends the string provided to the provided StringSeq. + void handle_string_seq (::XMLSchema::string &str, + CORBA::StringSeq &tofill); + + /// The Deployment spec references elements by + /// their position within their parent sequence. + /// These two methods allow an element's index + /// to be stored/retrieved. - /// Map the index of an element to its IDREF . - void bind_ref (ACE_TString& id, size_t index); + /// Map the index of an element to its IDREF . + void bind_ref (ACE_TString& id, size_t index); - /// Retrieve the index of an element with its IDREF . - /// Returns 0 if the was found. - int get_ref (ACE_TString& id, size_t val); + /// Retrieve the index of an element with its IDREF . + /// Returns 0 if the was found. + int get_ref (ACE_TString& id, size_t val); - private: + private: - /// The map used to store and look up the indexes - /// of elements referenced by their index. - IDREF_MAP idref_map_; + /// The map used to store and look up the indexes + /// of elements referenced by their index. + IDREF_MAP idref_map_; }; } -- cgit v1.2.1