diff options
author | William R. Otte <wotte@dre.vanderbilt.edu> | 2009-09-25 01:35:32 +0000 |
---|---|---|
committer | William R. Otte <wotte@dre.vanderbilt.edu> | 2009-09-25 01:35:32 +0000 |
commit | fb100d3ce47907f711ef152bbe50abf9f8e0bb95 (patch) | |
tree | 2a65df2dde8d83e467692de6d7a6e25dd0d24eba | |
parent | bd8f9c0298022fd14c7a8a9fb9a9869ee37ab6aa (diff) | |
download | ATCD-fb100d3ce47907f711ef152bbe50abf9f8e0bb95.tar.gz |
Fri Sep 25 01:34:02 UTC 2009 William R. Otte <wotte@dre.vanderbilt.edu>
13 files changed, 1240 insertions, 4 deletions
diff --git a/modules/CIAO/ChangeLog b/modules/CIAO/ChangeLog index 0ef2a51a8e2..703c459f7c2 100644 --- a/modules/CIAO/ChangeLog +++ b/modules/CIAO/ChangeLog @@ -1,3 +1,20 @@ +Fri Sep 25 01:34:02 UTC 2009 William R. Otte <wotte@dre.vanderbilt.edu> + + * connectors/dds4ccm/examples/Quoter/Broker/Broker.idl3: + * connectors/dds4ccm/examples/Quoter/Broker/Broker.idl3p: + * connectors/dds4ccm/examples/Quoter/Broker/Broker.mpc: + * connectors/dds4ccm/examples/Quoter/Broker/Broker_exec.h: + * connectors/dds4ccm/examples/Quoter/Broker/Broker_exec.cpp: + * connectors/dds4ccm/examples/Quoter/Connector/Quoter_Connector_exec.cpp: + * connectors/dds4ccm/examples/Quoter/Distributor/Distributor.idl3: + * connectors/dds4ccm/examples/Quoter/Distributor/Distributor.idl3p: + * connectors/dds4ccm/examples/Quoter/Distributor/Distributor.mpc: + * connectors/dds4ccm/examples/Quoter/Distributor/Distributor_exec.h: + * connectors/dds4ccm/examples/Quoter/Distributor/Distributor_exec.cpp: + * connectors/dds4ccm/examples/Quoter/Distributor/controller.cpp: + + Additional connector implementation. + Wed Sep 9 11:50:54 UTC 2009 William R. Otte <wotte@dre.vanderbilt.edu> * MPC/config/connectoridldefaults.mpb: @@ -14,8 +31,8 @@ Wed Sep 9 11:50:54 UTC 2009 William R. Otte <wotte@dre.vanderbilt.edu> * connectors/dds4ccm/impl/ndds/Writer.h: * connectors/dds4ccm/impl/ndds/Writer.tpp: - Additional connector implementation. - + Additional connector implementation. + * connectors/dds4ccm/examples/Quoter/Quoter: Removed this file. diff --git a/modules/CIAO/connectors/dds4ccm/examples/Quoter/Broker/Broker.idl3 b/modules/CIAO/connectors/dds4ccm/examples/Quoter/Broker/Broker.idl3 new file mode 100644 index 00000000000..a827b8d6b39 --- /dev/null +++ b/modules/CIAO/connectors/dds4ccm/examples/Quoter/Broker/Broker.idl3 @@ -0,0 +1,25 @@ +// $Id$ + +/** + * @file Broker.idl3 + * @author William R. Otte <wotte@dre.vanderbilt.edu> + */ + +#ifndef BROKER_IDL3 +#define BROKER_IDL3 + +#include "Connector/Quoter_Connector.idl3" + +module Quoter +{ + component Broker + { + uses CCM_DDS::Stock_Info_Reader info_out_data; + uses CCM_DDS::ListenerControl info_out_control; + provides CCM_DDS::Stock_Info_RawListener info_out_listener; + uses DDS::DataReader info_out_dds_entity; + provides CCM_DDS::PortStatusListener info_out_status; + }; +}; + +#endif
\ No newline at end of file diff --git a/modules/CIAO/connectors/dds4ccm/examples/Quoter/Broker/Broker.idl3p b/modules/CIAO/connectors/dds4ccm/examples/Quoter/Broker/Broker.idl3p new file mode 100644 index 00000000000..80dea70f53e --- /dev/null +++ b/modules/CIAO/connectors/dds4ccm/examples/Quoter/Broker/Broker.idl3p @@ -0,0 +1,23 @@ +// $Id$ + +/** + * @file Broker.idl3p + * @author William R. Otte <wotte@dre.vanderbilt.edu> + * + */ + +#ifndef BROKER_IDL3P +#define BROKER_IDL3P + +#include <dds4ccm/idl/dds4ccm_Connector_Base.idl3p> +#include <dds4ccm/idl/dds4ccm_Port_RawListen.idl3p> + +module Quoter +{ + component Broker + { + port CCM_DDS::DDS_RawListen <Stock_Info> info; + }; +}; + +#endif
\ No newline at end of file diff --git a/modules/CIAO/connectors/dds4ccm/examples/Quoter/Broker/Broker.mpc b/modules/CIAO/connectors/dds4ccm/examples/Quoter/Broker/Broker.mpc new file mode 100644 index 00000000000..55803f7c775 --- /dev/null +++ b/modules/CIAO/connectors/dds4ccm/examples/Quoter/Broker/Broker.mpc @@ -0,0 +1,137 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -l ../lib -o ../lib -u DDS -b dds4ccm_base Broker" + +project(DDS_Broker_idl_gen) : componentidldefaults , connectoridldefaults { + custom_only = 1 + after += DDS_Quoter_Connector_idl_gen + idlflags += -Wb,stub_export_macro=BROKER_STUB_Export \ + -Wb,stub_export_include=Broker_stub_export.h \ + -Wb,skel_export_macro=BROKER_SVNT_Export \ + -Wb,skel_export_include=Broker_svnt_export.h \ + -Wb,exec_export_macro=BROKER_EXEC_Export \ + -Wb,exec_export_include=Broker_exec_export.h -I.. + + IDL_Files { + Broker.idl3 + } +} + +project(DDS_Broker_lem_gen) : connectoridldefaults, { + after += DDS_Broker_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=BROKER_LEM_STUB_Export \ + -Wb,stub_export_include=Broker_lem_stub_export.h \ + -SS -Gxhst -I.. + + IDL_Files { + BrokerE.idl + } +} + +project(DDS_Broker_lem_stub) : ccm_svnt , dds4ccm_base { + after += DDS_Broker_lem_gen DDS_Broker_stub + libs += Broker_stub + libpaths += ../lib + libout = ../lib + includes += .. + sharedname = Broker_lem_stub + dynamicflags = BROKER_LEM_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + BrokerEC.cpp + } + + Header_Files { + BrokerEC.h + Broker_lem_stub_export.h + } + + Inline_Files { + BrokerEC.inl + } +} + +project(DDS_Broker_stub) : ccm_stub , dds4ccm_base { + after += DDS_Broker_idl_gen + libs += + libpaths += ../lib + libout = ../lib + includes += .. + sharedname = Broker_stub + dynamicflags = BROKER_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + BrokerC.cpp + } + + Header_Files { + BrokerC.h + Broker_stub_export.h + } + + Inline_Files { + BrokerC.inl + } +} + +project(DDS_Broker_exec) : ciao_executor , dds4ccm_base { + after += DDS_Broker_lem_stub DDS_Broker_stub + sharedname = Broker_exec + libs += Broker_stub Broker_lem_stub + libpaths += ../lib + libout = ../lib + includes += .. + dynamicflags = BROKER_EXEC_BUILD_DLL + + IDL_Files { + } + + Source_Files { + Broker_exec.cpp + } + + Header_Files { + Broker_exec.h + Broker_exec_export.h + } + + Inline_Files { + } +} + + +project(DDS_Broker_svnt) : ciao_servant , dds4ccm_base { + after += DDS_Broker_lem_stub + sharedname = Broker_svnt + libs += Broker_stub Broker_lem_stub + libpaths += ../lib + libout = ../lib + includes += .. + dynamicflags = BROKER_SVNT_BUILD_DLL + + IDL_Files { + } + + Source_Files { + BrokerS.cpp + Broker_svnt.cpp + } + + Header_Files { + BrokerS.h + Broker_svnt.h + Broker_svnt_export.h + } + + Inline_Files { + BrokerS.inl + } +} + + diff --git a/modules/CIAO/connectors/dds4ccm/examples/Quoter/Broker/Broker_exec.cpp b/modules/CIAO/connectors/dds4ccm/examples/Quoter/Broker/Broker_exec.cpp new file mode 100644 index 00000000000..0958d9882c3 --- /dev/null +++ b/modules/CIAO/connectors/dds4ccm/examples/Quoter/Broker/Broker_exec.cpp @@ -0,0 +1,179 @@ +// -*- C++ -*- +// +// $Id$ + +/** + * Code generated by the The ACE ORB (TAO) IDL Compiler v1.7.2 + * TAO and the TAO IDL Compiler have been developed by: + * Center for Distributed Object Computing + * Washington University + * St. Louis, MO + * USA + * http://www.cs.wustl.edu/~schmidt/doc-center.html + * and + * Distributed Object Computing Laboratory + * University of California at Irvine + * Irvine, CA + * USA + * http://doc.ece.uci.edu/ + * and + * Institute for Software Integrated Systems + * Vanderbilt University + * Nashville, TN + * USA + * http://www.isis.vanderbilt.edu/ + * + * Information about TAO is available at: + * http://www.cs.wustl.edu/~schmidt/TAO.html + **/ + +// TAO_IDL - Generated from +// be/be_codegen.cpp:1278 + +#include "Broker_exec.h" +#include "ciao/CIAO_common.h" + +namespace CIAO_Quoter_Broker_Impl +{ + //============================================================ + // Facet Executor Implementation Class: Stock_Info_RawListener_exec_i + //============================================================ + + Stock_Info_RawListener_exec_i::Stock_Info_RawListener_exec_i (void) + { + } + + Stock_Info_RawListener_exec_i::~Stock_Info_RawListener_exec_i (void) + { + } + + // Operations from ::CCM_DDS::Stock_Info_RawListener + + void + Stock_Info_RawListener_exec_i::on_data ( + const ::Quoter::Stock_Info & an_instance, + const ::CCM_DDS::ReadInfo & /* info */) + { + printf ("Stock_Info_RawListener: received a stock_info for <%s> at %u:%u:%u\n", + an_instance.symbol.in (), + an_instance.low, + an_instance.current, + an_instance.high); + } + //============================================================ + // Facet Executor Implementation Class: PortStatusListener_exec_i + //============================================================ + + PortStatusListener_exec_i::PortStatusListener_exec_i (void) + { + } + + PortStatusListener_exec_i::~PortStatusListener_exec_i (void) + { + } + + // Operations from ::CCM_DDS::PortStatusListener + + void + PortStatusListener_exec_i::on_requested_deadline_missed ( + ::DDS::DataReader_ptr /* the_reader */, + const ::DDS::RequestedDeadlineMissedStatus & /* status */) + { + /* Your code here. */ + } + + void + PortStatusListener_exec_i::on_sample_lost ( + ::DDS::DataReader_ptr /* the_reader */, + const ::DDS::SampleLostStatus & /* status */) + { + /* Your code here. */ + } + + //============================================================ + // Component Executor Implementation Class: Broker_exec_i + //============================================================ + + Broker_exec_i::Broker_exec_i (void) + { + } + + Broker_exec_i::~Broker_exec_i (void) + { + } + + // Supported operations and attributes. + + // Component attributes. + + // Port operations. + + ::CCM_DDS::CCM_Stock_Info_RawListener_ptr + Broker_exec_i::get_info_out_listener (void) + { + /* Your code here. */ + return new Stock_Info_RawListener_exec_i (); + } + + ::CCM_DDS::CCM_PortStatusListener_ptr + Broker_exec_i::get_info_out_status (void) + { + /* Your code here. */ + return ::CCM_DDS::CCM_PortStatusListener::_nil (); + } + + // Operations from Components::SessionComponent. + + void + Broker_exec_i::set_session_context ( + ::Components::SessionContext_ptr ctx) + { + ::Quoter::CCM_Broker_Context_var lctx = + ::Quoter::CCM_Broker_Context::_narrow (ctx); + + if ( ::CORBA::is_nil (lctx.in ())) + { + throw ::CORBA::INTERNAL (); + } + + this->context_ = lctx; + } + + void + Broker_exec_i::configuration_complete (void) + { + /* Your code here. */ + } + + void + Broker_exec_i::ccm_activate (void) + { + /* Your code here. */ + } + + void + Broker_exec_i::ccm_passivate (void) + { + /* Your code here. */ + } + + void + Broker_exec_i::ccm_remove (void) + { + /* Your code here. */ + } + + extern "C" BROKER_EXEC_Export ::Components::EnterpriseComponent_ptr + create_Quoter_Broker_Impl (void) + { + ::Components::EnterpriseComponent_ptr retval = + ::Components::EnterpriseComponent::_nil (); + + ACE_NEW_NORETURN ( + retval, + Broker_exec_i); + + return retval; + } +} + diff --git a/modules/CIAO/connectors/dds4ccm/examples/Quoter/Broker/Broker_exec.h b/modules/CIAO/connectors/dds4ccm/examples/Quoter/Broker/Broker_exec.h new file mode 100644 index 00000000000..5318cd91e5e --- /dev/null +++ b/modules/CIAO/connectors/dds4ccm/examples/Quoter/Broker/Broker_exec.h @@ -0,0 +1,138 @@ +// -*- C++ -*- +// +// $Id$ + +/** + * Code generated by the The ACE ORB (TAO) IDL Compiler v1.7.2 + * TAO and the TAO IDL Compiler have been developed by: + * Center for Distributed Object Computing + * Washington University + * St. Louis, MO + * USA + * http://www.cs.wustl.edu/~schmidt/doc-center.html + * and + * Distributed Object Computing Laboratory + * University of California at Irvine + * Irvine, CA + * USA + * http://doc.ece.uci.edu/ + * and + * Institute for Software Integrated Systems + * Vanderbilt University + * Nashville, TN + * USA + * http://www.isis.vanderbilt.edu/ + * + * Information about TAO is available at: + * http://www.cs.wustl.edu/~schmidt/TAO.html + **/ + +// TAO_IDL - Generated from +// be/be_codegen.cpp:1217 + +#ifndef CIAO_BROKER_EXEC_H_ +#define CIAO_BROKER_EXEC_H_ + +#include /**/ "ace/pre.h" + +#include "BrokerEC.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include /**/ "Broker_exec_export.h" +#include "tao/LocalObject.h" + +namespace CIAO_Quoter_Broker_Impl +{ + class BROKER_EXEC_Export Stock_Info_RawListener_exec_i + : public virtual ::CCM_DDS::CCM_Stock_Info_RawListener, + public virtual ::CORBA::LocalObject + { + public: + Stock_Info_RawListener_exec_i (void); + virtual ~Stock_Info_RawListener_exec_i (void); + + // Operations and attributes from ::CCM_DDS::Stock_Info_RawListener + + // TAO_IDL - Generated from + // be/be_visitor_operation/operation_ch.cpp:46 + + virtual void + on_data ( + const ::Quoter::Stock_Info & an_instance, + const ::CCM_DDS::ReadInfo & info); + }; + + class BROKER_EXEC_Export PortStatusListener_exec_i + : public virtual ::CCM_DDS::CCM_PortStatusListener, + public virtual ::CORBA::LocalObject + { + public: + PortStatusListener_exec_i (void); + virtual ~PortStatusListener_exec_i (void); + + // Operations and attributes from ::CCM_DDS::PortStatusListener + + // TAO_IDL - Generated from + // be/be_visitor_operation/operation_ch.cpp:46 + + virtual void + on_requested_deadline_missed ( + ::DDS::DataReader_ptr the_reader, + const ::DDS::RequestedDeadlineMissedStatus & status); + + // TAO_IDL - Generated from + // be/be_visitor_operation/operation_ch.cpp:46 + + virtual void + on_sample_lost ( + ::DDS::DataReader_ptr the_reader, + const ::DDS::SampleLostStatus & status); + }; + + class BROKER_EXEC_Export Broker_exec_i + : public virtual Broker_Exec, + public virtual ::CORBA::LocalObject + { + public: + Broker_exec_i (void); + virtual ~Broker_exec_i (void); + + // Supported operations and attributes. + + // Component attributes. + + // Port operations. + + virtual ::CCM_DDS::CCM_Stock_Info_RawListener_ptr + get_info_out_listener (void); + + virtual ::CCM_DDS::CCM_PortStatusListener_ptr + get_info_out_status (void); + + // Operations from Components::SessionComponent. + + virtual void + set_session_context ( + ::Components::SessionContext_ptr ctx); + + virtual void configuration_complete (void); + + virtual void ccm_activate (void); + virtual void ccm_passivate (void); + virtual void ccm_remove (void); + + private: + ::Quoter::CCM_Broker_Context_var context_; + }; + + extern "C" BROKER_EXEC_Export ::Components::EnterpriseComponent_ptr + create_Quoter_Broker_Impl (void); +} + +#include /**/ "ace/post.h" + +#endif /* ifndef */ + diff --git a/modules/CIAO/connectors/dds4ccm/examples/Quoter/Connector/Quoter_Connector_exec.cpp b/modules/CIAO/connectors/dds4ccm/examples/Quoter/Connector/Quoter_Connector_exec.cpp index 9ca513a3c0b..eac85364f70 100644 --- a/modules/CIAO/connectors/dds4ccm/examples/Quoter/Connector/Quoter_Connector_exec.cpp +++ b/modules/CIAO/connectors/dds4ccm/examples/Quoter/Connector/Quoter_Connector_exec.cpp @@ -606,7 +606,7 @@ namespace CIAO_Quoter_Quoter_Connector_Impl } void - ::configure_default_topic_ (void) + Quoter_Connector_exec_i::configure_default_topic_ (void) { if (this->default_topic_configured_) return; @@ -638,7 +638,7 @@ namespace CIAO_Quoter_Quoter_Connector_Impl if (this->__info_in_configured_) return; - this->configure_default_topic_ (void); + this->configure_default_topic_ (); try { diff --git a/modules/CIAO/connectors/dds4ccm/examples/Quoter/Distributor/Distributor.idl3 b/modules/CIAO/connectors/dds4ccm/examples/Quoter/Distributor/Distributor.idl3 new file mode 100644 index 00000000000..ff3a3ca2a8c --- /dev/null +++ b/modules/CIAO/connectors/dds4ccm/examples/Quoter/Distributor/Distributor.idl3 @@ -0,0 +1,33 @@ +// $Id$ + +/** + * @file Distributor.idl3 + * @author William R. Otte <wotte@dre.vanderbilt.edu> + * + * by-hand idl3 translation of distributor components. + */ + +#ifndef DDS_DISTRIBUTOR_IDL3 +#define DDS_DISTRIBUTOR_IDL3 + +#include "Connector/Quoter_Connector.idl3" + +module Quoter +{ + interface Trigger + { + void add_stock (in string stock); + void del_stock (in string stock); + void start (); + void stop (); + }; + + component Distributor supports Trigger + { + uses CCM_DDS::Stock_Info_Writer info_in_data; + uses ::DDS::DataWriter info_in_dds_entity; + attribute unsigned long rate; + }; +}; + +#endif
\ No newline at end of file diff --git a/modules/CIAO/connectors/dds4ccm/examples/Quoter/Distributor/Distributor.idl3p b/modules/CIAO/connectors/dds4ccm/examples/Quoter/Distributor/Distributor.idl3p new file mode 100644 index 00000000000..a8e481334db --- /dev/null +++ b/modules/CIAO/connectors/dds4ccm/examples/Quoter/Distributor/Distributor.idl3p @@ -0,0 +1,19 @@ +// $Id$ + +/** + * @file Distributor.idl3p + * @author William R. Otte <wotte@dre.vanderbilt.edu> + */ + +#ifndef DDS_DISTRIBUTOR_IDL3p +#define DDS_DISTRIBUTOR_IDL3p + +module Quoter +{ + component Distributor + { + port CCM_DDS::DDS_Write <Stock_Info> info; + }; +}; + +#endif diff --git a/modules/CIAO/connectors/dds4ccm/examples/Quoter/Distributor/Distributor.mpc b/modules/CIAO/connectors/dds4ccm/examples/Quoter/Distributor/Distributor.mpc new file mode 100644 index 00000000000..0fb6a755d24 --- /dev/null +++ b/modules/CIAO/connectors/dds4ccm/examples/Quoter/Distributor/Distributor.mpc @@ -0,0 +1,160 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -p DDS_Quoter_Base -l ../lib -o ../lib -c controller -u DDS Distributor" + +project(DDS_Distributor_idl_gen) : connectoridldefaults, componentidldefaults { + after += DDS_Quoter_Connector_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=DISTRIBUTOR_STUB_Export \ + -Wb,stub_export_include=Distributor_stub_export.h \ + -Wb,skel_export_macro=DISTRIBUTOR_SVNT_Export \ + -Wb,skel_export_include=Distributor_svnt_export.h \ + -Wb,exec_export_macro=DISTRIBUTOR_EXEC_Export \ + -Wb,exec_export_include=Distributor_exec_export.h \ + -I .. + + IDL_Files { + Distributor.idl3 + } +} + +project(DDS_Distributor_lem_gen) : connectoridldefaults { + after += DDS_Distributor_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=DISTRIBUTOR_LEM_STUB_Export \ + -Wb,stub_export_include=Distributor_lem_stub_export.h \ + -SS -Gxhst -I $CIAO_ROOT/connectors -I .. + + IDL_Files { + DistributorE.idl + } +} + +project(DDS_Distributor_lem_stub) : ccm_svnt, dds4ccm_base { + after += DDS_Distributor_lem_gen DDS_Distributor_stub DDS_Quoter_Base_stub + libs += DDS_Quoter_Base_stub Distributor_stub + libpaths += ../lib + libout = ../lib + includes += .. + sharedname = Distributor_lem_stub + dynamicflags = DISTRIBUTOR_LEM_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + DistributorEC.cpp + } + + Header_Files { + DistributorEC.h + Distributor_lem_stub_export.h + } + + Inline_Files { + DistributorEC.inl + } +} + +project(DDS_Distributor_stub) : ccm_stub, dds4ccm_base { + after += DDS_Distributor_idl_gen DDS_Quoter_Base_stub + libs += DDS_Quoter_Base_stub + includes += .. + libpaths += ../lib + libout = ../lib + sharedname = Distributor_stub + dynamicflags = DISTRIBUTOR_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + DistributorC.cpp + } + + Header_Files { + DistributorC.h + Distributor_stub_export.h + } + + Inline_Files { + DistributorC.inl + } +} + +project(DDS_Distributor_exec) : ciao_executor, dds4ccm_base { + after += DDS_Distributor_lem_stub DDS_Distributor_stub + sharedname = Distributor_exec + libs += Distributor_stub Distributor_lem_stub DDS_Quoter_Base_stub + libpaths += ../lib + includes += .. + libout = ../lib + dynamicflags = DISTRIBUTOR_EXEC_BUILD_DLL + + IDL_Files { + } + + Source_Files { + Distributor_exec.cpp + } + + Header_Files { + Distributor_exec.h + Distributor_exec_export.h + } + + Inline_Files { + } +} + + +project(DDS_Distributor_svnt) : ciao_servant, dds4ccm_base { + after += DDS_Quoter_Base_skel DDS_Distributor_lem_stub + sharedname = Distributor_svnt + libs += Distributor_stub Distributor_lem_stub \ + DDS_Quoter_Base_skel \ + DDS_Quoter_Base_stub + libpaths += ../lib + libout = ../lib + includes += .. + dynamicflags = DISTRIBUTOR_SVNT_BUILD_DLL + + IDL_Files { + } + + Source_Files { + DistributorS.cpp + Distributor_svnt.cpp + } + + Header_Files { + DistributorS.h + Distributor_svnt.h + Distributor_svnt_export.h + } + + Inline_Files { + DistributorS.inl + } +} + +project (DDS_controller) : ccm_stub, valuetype { + exename = controller + after += DDS_Distributor_stub + libs += Distributor_stub DDS_Quoter_Base_stub + libpaths += ../lib + libout = ../lib + includes += .. + IDL_Files { + } + + Source_Files { + controller.cpp + } + + Header_Files { + } + + Inline_Files { + } +} + diff --git a/modules/CIAO/connectors/dds4ccm/examples/Quoter/Distributor/Distributor_exec.cpp b/modules/CIAO/connectors/dds4ccm/examples/Quoter/Distributor/Distributor_exec.cpp new file mode 100644 index 00000000000..56cd45df8c9 --- /dev/null +++ b/modules/CIAO/connectors/dds4ccm/examples/Quoter/Distributor/Distributor_exec.cpp @@ -0,0 +1,316 @@ +// -*- C++ -*- +// +// $Id$ + +/** + * Code generated by the The ACE ORB (TAO) IDL Compiler v1.7.2 + * TAO and the TAO IDL Compiler have been developed by: + * Center for Distributed Object Computing + * Washington University + * St. Louis, MO + * USA + * http://www.cs.wustl.edu/~schmidt/doc-center.html + * and + * Distributed Object Computing Laboratory + * University of California at Irvine + * Irvine, CA + * USA + * http://doc.ece.uci.edu/ + * and + * Institute for Software Integrated Systems + * Vanderbilt University + * Nashville, TN + * USA + * http://www.isis.vanderbilt.edu/ + * + * Information about TAO is available at: + * http://www.cs.wustl.edu/~schmidt/TAO.html + **/ + +// TAO_IDL - Generated from +// be/be_codegen.cpp:1278 + +#include "Distributor_exec.h" +#include "ciao/CIAO_common.h" +#include "ace/Reactor.h" +#include "ace/Guard_T.h" +#include "ace/CORBA_macros.h" +#include "ace/OS_NS_time.h" +#include <iostream> + +namespace CIAO_Quoter_Distributor_Impl +{ + //============================================================ + // Component Executor Implementation Class: Distributor_exec_i + //============================================================ + + pulse_Generator::pulse_Generator (Distributor_exec_i &callback) + : active_ (0), + pulse_callback_ (callback) + { + // initialize the reactor + this->reactor (ACE_Reactor::instance ()); + } + + pulse_Generator::~pulse_Generator () + { + } + + int + pulse_Generator::open_h () + { + // convert the task into a active object that runs in separate thread + return this->activate (); + } + + int + pulse_Generator::close_h () + { + this->reactor ()->end_reactor_event_loop (); + + // wait for all threads in the task to exit before it returns + return this->wait (); + } + + int + pulse_Generator::start (CORBA::ULong hertz) + { + // return if not valid + if (hertz == 0 || this->active_ != 0) + { + return -1; + } + + // calculate the interval time + long usec = 1000000 / hertz; + + if (this->reactor ()->schedule_timer (this, + 0, + ACE_Time_Value (0, usec), + ACE_Time_Value (0, usec)) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "Unable to setup Timer\n"), + -1); + + } + + this->active_ = 1; + return 0; + } + + int + pulse_Generator::stop (void) + { + // return if not valid. + if (this->active_ == 0) + { + return -1; + } + // cancle the timer + this->reactor ()->cancel_timer (this); + this->active_ = 0; + return 0; + } + + int + pulse_Generator::active (void) + { + return this->active_; + } + + int + pulse_Generator::handle_close (ACE_HANDLE handle, + ACE_Reactor_Mask close_mask) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("[%x] handle = %d, close_mask = %d\n"), + this, + handle, + close_mask)); + return 0; + } + + int + pulse_Generator::handle_timeout (const ACE_Time_Value &, + const void *) + { + // Notify the subscribers + this->pulse_callback_.tick (); + return 0; + } + + int + pulse_Generator::svc (void) + { + // define the owner of the reactor thread + this->reactor ()->owner (ACE_OS::thr_self ()); + + // run event loop to wait for event, and then dispatch them to corresponding handlers + this->reactor ()->run_reactor_event_loop (); + + return 0; + } + + Distributor_exec_i::Distributor_exec_i (void) + : rate_ (5) + { + ACE_OS::srand (ACE_OS::time ()); + this->ticker_ = new pulse_Generator (*this); + } + + Distributor_exec_i::~Distributor_exec_i (void) + { + } + + // Supported operations and attributes. + + void + Distributor_exec_i::tick (void) + { + std::cerr << "Ticking" << std::endl; + + for (Stock_Table::iterator i = this->stocks_.begin (); + i != this->stocks_.end (); + ++i) + { + if (ACE_OS::rand () % 2) + { + std::cerr << "Updating stock: " << i->first << std::endl; + + int delta = (ACE_OS::rand () % 10) - 5; + + i->second->current += delta; + + if (i->second->current > i->second->high) + i->second->high = i->second->current; + + if (i->second->current < i->second->low) + i->second->low = i->second->current; + + this->writer_->write (i->second); + } + } + } + + void + Distributor_exec_i::add_stock ( + const char * stock) + { + std::cerr << "Distributor_exec_i::add_stock - Adding stock: " << stock << std::endl; + + ACE_GUARD_THROW_EX (ACE_Thread_Mutex, _guard, + this->mutex_, CORBA::INTERNAL ()); + + Quoter::Stock_Info *new_stock = new Quoter::Stock_Info; + + new_stock->low = 50; + new_stock->high = 50; + new_stock->current = 50; + new_stock->symbol = stock; + + this->stocks_[stock] = new_stock; + } + + void + Distributor_exec_i::del_stock (const char * stock) + { + std::cerr << "Distributor_exec_i::del_stock - Removing stock: " << stock << std::endl; + + ACE_GUARD_THROW_EX (ACE_Thread_Mutex, _guard, + this->mutex_, CORBA::INTERNAL ()); + + Stock_Table::iterator pos = this->stocks_.find (stock); + + if (pos != this->stocks_.end ()) + { + this->stocks_.erase (pos); + } + + std::cerr << "Distributor_exec_i::del_stock - Stock no present: " << stock; + } + + void + Distributor_exec_i::start (void) + { + this->ticker_->start (this->rate_); + } + + void + Distributor_exec_i::stop (void) + { + this->ticker_->stop (); + } + + // Component attributes. + + ::CORBA::ULong + Distributor_exec_i::rate (void) + { + return this->rate_; + } + + void + Distributor_exec_i::rate ( + ::CORBA::ULong rate ) + { + this->rate_ = rate; + } + + // Port operations. + + // Operations from Components::SessionComponent. + + void + Distributor_exec_i::set_session_context ( + ::Components::SessionContext_ptr ctx) + { + ::Quoter::CCM_Distributor_Context_var lctx = + ::Quoter::CCM_Distributor_Context::_narrow (ctx); + + if ( ::CORBA::is_nil (lctx.in ())) + { + throw ::CORBA::INTERNAL (); + } + + this->context_ = lctx; + } + + void + Distributor_exec_i::configuration_complete (void) + { + /* Your code here. */ + } + + void + Distributor_exec_i::ccm_activate (void) + { + this->start (); + } + + void + Distributor_exec_i::ccm_passivate (void) + { + /* Your code here. */ + } + + void + Distributor_exec_i::ccm_remove (void) + { + /* Your code here. */ + } + + extern "C" DISTRIBUTOR_EXEC_Export ::Components::EnterpriseComponent_ptr + create_Quoter_Distributor_Impl (void) + { + ::Components::EnterpriseComponent_ptr retval = + ::Components::EnterpriseComponent::_nil (); + + ACE_NEW_NORETURN ( + retval, + Distributor_exec_i); + + return retval; + } +} + diff --git a/modules/CIAO/connectors/dds4ccm/examples/Quoter/Distributor/Distributor_exec.h b/modules/CIAO/connectors/dds4ccm/examples/Quoter/Distributor/Distributor_exec.h new file mode 100644 index 00000000000..1f254e99e1a --- /dev/null +++ b/modules/CIAO/connectors/dds4ccm/examples/Quoter/Distributor/Distributor_exec.h @@ -0,0 +1,189 @@ +// -*- C++ -*- +// +// $Id$ + +/** + * Code generated by the The ACE ORB (TAO) IDL Compiler v1.7.2 + * TAO and the TAO IDL Compiler have been developed by: + * Center for Distributed Object Computing + * Washington University + * St. Louis, MO + * USA + * http://www.cs.wustl.edu/~schmidt/doc-center.html + * and + * Distributed Object Computing Laboratory + * University of California at Irvine + * Irvine, CA + * USA + * http://doc.ece.uci.edu/ + * and + * Institute for Software Integrated Systems + * Vanderbilt University + * Nashville, TN + * USA + * http://www.isis.vanderbilt.edu/ + * + * Information about TAO is available at: + * http://www.cs.wustl.edu/~schmidt/TAO.html + **/ + +// TAO_IDL - Generated from +// be/be_codegen.cpp:1217 + +#ifndef CIAO_DISTRIBUTOR_EXEC_H_ +#define CIAO_DISTRIBUTOR_EXEC_H_ + +#include /**/ "ace/pre.h" + +#include "DistributorEC.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include /**/ "Distributor_exec_export.h" +#include "tao/LocalObject.h" +#include "ace/Thread_Mutex.h" +#include "ace/Task.h" +#include "ace/Reactor.h" + +#include <map> + +namespace CIAO_Quoter_Distributor_Impl +{ + class Distributor_exec_i; + + /** + * @class pulse generator + * + * @brief an active object used by StockDistributor to perform periodical pulse generation + * + */ + class pulse_Generator : public ACE_Task_Base + { + public: + pulse_Generator (Distributor_exec_i &callback); + + ~pulse_Generator (); + + /// Hook method that performs application-defined initialization activities + int open_h (void); + + /// Hook method that performs application-defined destruction activites + int close_h (void); + + /// appliation-defined method for starting the pulse-generation service + int start (CORBA::ULong hertz); + + /// application-defined method for stopping the pulse-generation service + int stop (void); + + /// Indicate whether the current object is active + int active (void); + + /// Handle the timeout. + virtual int handle_timeout (const ACE_Time_Value &tv, + const void *arg); + + /// Called when timer handler is removed. + virtual int handle_close (ACE_HANDLE handle, + ACE_Reactor_Mask close_mask); + + /// Hook methods implemnting the task's service processing, + /// invoked by all threads activated by activate () method + virtual int svc (void); + + private: + /// Tracking whether we are actively generating pulse or not. + int active_; + + /// Maintains a handle that actually process the event + Distributor_exec_i &pulse_callback_; + + }; + + class DISTRIBUTOR_EXEC_Export Distributor_exec_i + : public virtual Distributor_Exec, + public virtual ::CORBA::LocalObject + { + public: + Distributor_exec_i (void); + virtual ~Distributor_exec_i (void); + + void tick (void); + + // Supported operations and attributes. + + // TAO_IDL - Generated from + // be/be_visitor_operation/operation_ch.cpp:46 + + virtual void + add_stock ( + const char * stock); + + // TAO_IDL - Generated from + // be/be_visitor_operation/operation_ch.cpp:46 + + virtual void + del_stock ( + const char * stock); + + // TAO_IDL - Generated from + // be/be_visitor_operation/operation_ch.cpp:46 + + virtual void + start (void); + + // TAO_IDL - Generated from + // be/be_visitor_operation/operation_ch.cpp:46 + + virtual void + stop (void); + + // Component attributes. + + // TAO_IDL - Generated from + // be/be_visitor_operation/operation_ch.cpp:46 + + virtual ::CORBA::ULong + rate (void); + + // TAO_IDL - Generated from + // be/be_visitor_operation/operation_ch.cpp:46 + + virtual void + rate ( + ::CORBA::ULong rate); + + // Port operations. + + // Operations from Components::SessionComponent. + + virtual void + set_session_context ( + ::Components::SessionContext_ptr ctx); + + virtual void configuration_complete (void); + + virtual void ccm_activate (void); + virtual void ccm_passivate (void); + virtual void ccm_remove (void); + + private: + pulse_Generator * ticker_; + ::Quoter::CCM_Distributor_Context_var context_; + ACE_Thread_Mutex mutex_; + typedef std::map<std::string, Quoter::Stock_Info_var> Stock_Table; + Stock_Table stocks_; + CORBA::ULong rate_; + CCM_DDS::Stock_Info_Writer_var writer_; + }; + + extern "C" DISTRIBUTOR_EXEC_Export ::Components::EnterpriseComponent_ptr + create_Quoter_Distributor_Impl (void); +} + +#include /**/ "ace/post.h" + +#endif /* ifndef */ + diff --git a/modules/CIAO/connectors/dds4ccm/examples/Quoter/Distributor/controller.cpp b/modules/CIAO/connectors/dds4ccm/examples/Quoter/Distributor/controller.cpp new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/modules/CIAO/connectors/dds4ccm/examples/Quoter/Distributor/controller.cpp |