From ea5869cfb43e4454b303c18623ffbb8d187edb3b Mon Sep 17 00:00:00 2001 From: mxiong Date: Fri, 24 Mar 2006 16:53:58 +0000 Subject: ChangeLogTag:Fri Mar 24 16:53:15 UTC 2006 xiong,ming --- .../CIAO_Events/CIAOEvents_Handler.cpp | 116 +++++++++++++++++++++ .../CIAO_Events/CIAOEvents_Handler.h | 72 +++++++++++++ .../CIAO_Events/CIAO_Events_Handlers.mpc | 20 ++++ .../CIAO_Events/CIAO_Events_Handlers_Export.h | 54 ++++++++++ 4 files changed, 262 insertions(+) create mode 100644 TAO/CIAO/tools/Config_Handlers/CIAO_Events/CIAOEvents_Handler.cpp create mode 100644 TAO/CIAO/tools/Config_Handlers/CIAO_Events/CIAOEvents_Handler.h create mode 100644 TAO/CIAO/tools/Config_Handlers/CIAO_Events/CIAO_Events_Handlers.mpc create mode 100644 TAO/CIAO/tools/Config_Handlers/CIAO_Events/CIAO_Events_Handlers_Export.h diff --git a/TAO/CIAO/tools/Config_Handlers/CIAO_Events/CIAOEvents_Handler.cpp b/TAO/CIAO/tools/Config_Handlers/CIAO_Events/CIAOEvents_Handler.cpp new file mode 100644 index 00000000000..ffe688ffcdc --- /dev/null +++ b/TAO/CIAO/tools/Config_Handlers/CIAO_Events/CIAOEvents_Handler.cpp @@ -0,0 +1,116 @@ +// $Id$ +#include "Utils/XML_Helper.h" +#include "CIAOEvents_Handler.h" +#include "CIAOEvents.hpp" +#include "ciao/Deployment_EventsC.h" + +namespace CIAO +{ + namespace Config_Handlers + { + CIAOEvents_Handler::CIAOEvents_Handler (const ACE_TCHAR *file) : + idl_esd_(0), + esd_(0), + retval_ (false) + { + XML_Helper helper; + + XERCES_CPP_NAMESPACE::DOMDocument *dom = + helper.create_dom (file); + + if (!dom) + throw CIAOEvents_Handler::NoESD (); + + this->esd_.reset (new CIAOEventsDef + (CIAOEvents (dom))); + + if (!this->build_esd ()) + throw NoESD (); + } + + CIAOEvents_Handler::CIAOEvents_Handler (CIAOEventsDef *esd): + idl_esd_(0), + esd_(esd), + retval_(false) + { + if(!this->build_esd()) + throw NoESD (); + } + + + CIAOEvents_Handler::~CIAOEvents_Handler (void) + { + } + + bool + CIAOEvents_Handler::build_esd () + { + this->idl_esd_.reset ( new ::CIAO::DAnCE::EventServiceDeploymentDescriptions ); + + + CORBA::ULong num (this->idl_esd_->length ()); + + this->idl_esd_->length (this->esd_->count_eventServiceConfiguration ()); + + for (CIAOEventsDef::eventServiceConfiguration_const_iterator i = this->esd_->begin_eventServiceConfiguration (); + i != this->esd_->end_eventServiceConfiguration (); + i++) + { + CIAO::DAnCE::EventServiceDeploymentDescription a_esd; + + a_esd.name = CORBA::string_dup (i->name ().c_str ()); + a_esd.node = CORBA::string_dup (i->node ().c_str ()); + + switch (i->type ().integral ()) + { + case ::CIAO::Config_Handlers::EventServiceType::EC_l: + a_esd.type = CIAO::DAnCE::EC; + break; + case ::CIAO::Config_Handlers::EventServiceType::NOTIFY_l: + a_esd.type = CIAO::DAnCE::NOTIFY; + break; + case ::CIAO::Config_Handlers::EventServiceType::RTEC_l: + a_esd.type = CIAO::DAnCE::RTEC; + break; + case ::CIAO::Config_Handlers::EventServiceType::RTNOTIFY_l: + a_esd.type = CIAO::DAnCE::RTNOTIFY; + break; + default: + ACE_ERROR ((LM_ERROR, + "Invalid event service type\n")); + return false; + } + + a_esd.svc_cfg_file = CORBA::string_dup (i->svc_cfg_file ().c_str ()); + + (*this->idl_esd_)[num] = a_esd; + num++; + } + return true; + } + + + ::CIAO::DAnCE::EventServiceDeploymentDescriptions const * + CIAOEvents_Handler::esd_idl () const + throw (CIAOEvents_Handler::NoESD) + { + if(!this->idl_esd_.get()) + throw NoESD (); + + //else + return this->idl_esd_.get(); + } + + ::CIAO::DAnCE::EventServiceDeploymentDescriptions * + CIAOEvents_Handler::esd_idl () + throw (CIAOEvents_Handler::NoESD) + { + if(!this->idl_esd_.get()) + throw NoESD(); + + //else + return this->idl_esd_.release(); + } + } +} + diff --git a/TAO/CIAO/tools/Config_Handlers/CIAO_Events/CIAOEvents_Handler.h b/TAO/CIAO/tools/Config_Handlers/CIAO_Events/CIAOEvents_Handler.h new file mode 100644 index 00000000000..d6a183deb0a --- /dev/null +++ b/TAO/CIAO/tools/Config_Handlers/CIAO_Events/CIAOEvents_Handler.h @@ -0,0 +1,72 @@ +//================================================ +/** + * @file CIAOEvents_Handler.h + * + * $Id$ + * + * @author Ming Xiong + */ +//================================================ + +#ifndef CIAO_CONFIG_HANDLERS_CIAOEvents_HANDLER_H +#define CIAO_CONFIG_HANDLERS_CIAOEvents_HANDLER_H + +#include /**/ "ace/pre.h" + +#include "Utils/XML_Helper.h" +#include "ciao/Deployment_EventsC.h" +#include "CIAO_Events_Handlers_Export.h" +#include "ciao/DeploymentC.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + + +namespace CIAO +{ + namespace Config_Handlers + { + class CIAOEventsDef; + + /* + * @class CIAOEvents_Handler + * + * @brief Handler class for 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 CIAO_Events_Handlers_Export CIAOEvents_Handler + { + + public: + class NoESD {}; + + CIAOEvents_Handler (const ACE_TCHAR *file); + + CIAOEvents_Handler(CIAOEventsDef *esd); + + ~CIAOEvents_Handler (void); + + CIAO::DAnCE::EventServiceDeploymentDescriptions const *esd_idl (void) const; + + CIAO::DAnCE::EventServiceDeploymentDescriptions *esd_idl (void); + + private: + bool build_esd (); + + auto_ptr idl_esd_; + + auto_ptr esd_; + + bool retval_; + + }; + } +} + +#include /**/ "ace/post.h" +#endif /* CIAO_CONFIG_HANDLERS_CIAOEvents_HANDLER_H*/ diff --git a/TAO/CIAO/tools/Config_Handlers/CIAO_Events/CIAO_Events_Handlers.mpc b/TAO/CIAO/tools/Config_Handlers/CIAO_Events/CIAO_Events_Handlers.mpc new file mode 100644 index 00000000000..09bbc4c9194 --- /dev/null +++ b/TAO/CIAO/tools/Config_Handlers/CIAO_Events/CIAO_Events_Handlers.mpc @@ -0,0 +1,20 @@ +//$Id$ + +project (CIAO_Events_Handlers) : acelib, ciao_deployment_stub, xerces { + sharedname = CIAO_Events_Handlers + dynamicflags = CIAO_EVENTS_HANDLERS_BUILD_DLL + macros += XML_USE_PTHREADS + requires += exceptions + includes += $(CIAO_ROOT)/tools/Config_Handlers + after += CIAO_XML_Utils + libs += CIAO_XML_Utils + includes += $(CIAO_ROOT)/ciao + + Source_Files { + CIAOEvents.cpp + CIAOEvents_Handler.cpp + } + + Header_Files { + } +} \ No newline at end of file diff --git a/TAO/CIAO/tools/Config_Handlers/CIAO_Events/CIAO_Events_Handlers_Export.h b/TAO/CIAO/tools/Config_Handlers/CIAO_Events/CIAO_Events_Handlers_Export.h new file mode 100644 index 00000000000..efe95849905 --- /dev/null +++ b/TAO/CIAO/tools/Config_Handlers/CIAO_Events/CIAO_Events_Handlers_Export.h @@ -0,0 +1,54 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl -n CIAO_Events_Handlers +// ------------------------------ +#ifndef CIAO_EVENTS_HANDLERS_EXPORT_H +#define CIAO_EVENTS_HANDLERS_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (CIAO_EVENTS_HANDLERS_HAS_DLL) +# define CIAO_EVENTS_HANDLERS_HAS_DLL 1 +#endif /* ! CIAO_EVENTS_HANDLERS_HAS_DLL */ + +#if defined (CIAO_EVENTS_HANDLERS_HAS_DLL) && (CIAO_EVENTS_HANDLERS_HAS_DLL == 1) +# if defined (CIAO_EVENTS_HANDLERS_BUILD_DLL) +# define CIAO_Events_Handlers_Export ACE_Proper_Export_Flag +# define CIAO_EVENTS_HANDLERS_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define CIAO_EVENTS_HANDLERS_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* CIAO_EVENTS_HANDLERS_BUILD_DLL */ +# define CIAO_Events_Handlers_Export ACE_Proper_Import_Flag +# define CIAO_EVENTS_HANDLERS_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define CIAO_EVENTS_HANDLERS_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* CIAO_EVENTS_HANDLERS_BUILD_DLL */ +#else /* CIAO_EVENTS_HANDLERS_HAS_DLL == 1 */ +# define CIAO_Events_Handlers_Export +# define CIAO_EVENTS_HANDLERS_SINGLETON_DECLARATION(T) +# define CIAO_EVENTS_HANDLERS_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* CIAO_EVENTS_HANDLERS_HAS_DLL == 1 */ + +// Set CIAO_EVENTS_HANDLERS_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (CIAO_EVENTS_HANDLERS_NTRACE) +# if (ACE_NTRACE == 1) +# define CIAO_EVENTS_HANDLERS_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define CIAO_EVENTS_HANDLERS_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !CIAO_EVENTS_HANDLERS_NTRACE */ + +#if (CIAO_EVENTS_HANDLERS_NTRACE == 1) +# define CIAO_EVENTS_HANDLERS_TRACE(X) +#else /* (CIAO_EVENTS_HANDLERS_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define CIAO_EVENTS_HANDLERS_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (CIAO_EVENTS_HANDLERS_NTRACE == 1) */ + +#endif /* CIAO_EVENTS_HANDLERS_EXPORT_H */ + +// End of auto generated file. -- cgit v1.2.1