diff options
author | William R. Otte <wotte@dre.vanderbilt.edu> | 2009-08-05 14:26:32 +0000 |
---|---|---|
committer | William R. Otte <wotte@dre.vanderbilt.edu> | 2009-08-05 14:26:32 +0000 |
commit | 727a49d3cef70fc81000df81a068ed2b1c357ff1 (patch) | |
tree | d5784c4496a78312a250b841ed845c4e7b71d99a | |
parent | 3fedd48a0ed5b79d3945635106f038c2eb905f70 (diff) | |
download | ATCD-727a49d3cef70fc81000df81a068ed2b1c357ff1.tar.gz |
Wed Aug 5 14:25:09 UTC 2009 William R. Otte <Wotte@dre.vanderbilt.edu>
4 files changed, 113 insertions, 58 deletions
diff --git a/modules/CIAO/ChangeLog b/modules/CIAO/ChangeLog index 9607d6ad0a9..97bd57b51cd 100644 --- a/modules/CIAO/ChangeLog +++ b/modules/CIAO/ChangeLog @@ -1,3 +1,12 @@ +Wed Aug 5 14:25:09 UTC 2009 William R. Otte <Wotte@dre.vanderbilt.edu> + + * connectors/dds4ccm/examples/Hello/Receiver/Hello_Receiver.idl: + * connectors/dds4ccm/examples/Hello/Receiver/Hello_Receiver_exec.h: + * connectors/dds4ccm/examples/Hello/Receiver/Hello_Receiver_exec.cpp: + + Added some configuration attributes to provide a hint to the receiver as to + how many samples it should be receiving. + Wed Aug 5 14:00:06 UTC 2009 William R. Otte <Wotte@dre.vanderbilt.edu> * DAnCE/NodeApplicationManager/NodeApplicationManager_Impl.cpp: diff --git a/modules/CIAO/connectors/dds4ccm/examples/Hello/Receiver/Hello_Receiver.idl b/modules/CIAO/connectors/dds4ccm/examples/Hello/Receiver/Hello_Receiver.idl index 6a08fab3a31..9c8e6b3d737 100644 --- a/modules/CIAO/connectors/dds4ccm/examples/Hello/Receiver/Hello_Receiver.idl +++ b/modules/CIAO/connectors/dds4ccm/examples/Hello/Receiver/Hello_Receiver.idl @@ -16,6 +16,8 @@ module Hello_DDS provides CCM_DDS::string_RawListener read_message_listener; uses DDS::DataReader read_message_dds_entity; provides CCM_DDS::PortStatusListener read_message_status; + + attribute unsigned long expected_samples; }; home ReceiverHome manages Receiver diff --git a/modules/CIAO/connectors/dds4ccm/examples/Hello/Receiver/Hello_Receiver_exec.cpp b/modules/CIAO/connectors/dds4ccm/examples/Hello/Receiver/Hello_Receiver_exec.cpp index 4bac20d54f9..5ff422f0a8b 100644 --- a/modules/CIAO/connectors/dds4ccm/examples/Hello/Receiver/Hello_Receiver_exec.cpp +++ b/modules/CIAO/connectors/dds4ccm/examples/Hello/Receiver/Hello_Receiver_exec.cpp @@ -31,13 +31,16 @@ #include "Hello_Receiver_exec.h" #include "ciao/CIAO_common.h" +#include "ace/Atomic_Op.h" + namespace CIAO_Hello_DDS_Receiver_Impl { //============================================================ // Facet Executor Implementation Class: string_RawListener_exec_i //============================================================ - string_RawListener_exec_i::string_RawListener_exec_i (void) + string_RawListener_exec_i::string_RawListener_exec_i (Atomic_ULong &received) + : received_ (received) { } @@ -52,6 +55,7 @@ namespace CIAO_Hello_DDS_Receiver_Impl const char * an_instance, const ::CCM_DDS::ReadInfo & /* info */) { + ++received_; printf ("string raw listener received %s\n", an_instance); ACE_DEBUG ((LM_DEBUG, ACE_TEXT("Receiver received: %C\n"), an_instance)); } @@ -59,7 +63,8 @@ namespace CIAO_Hello_DDS_Receiver_Impl // Facet Executor Implementation Class: PortStatusListener_exec_i //============================================================ - PortStatusListener_exec_i::PortStatusListener_exec_i (void) + PortStatusListener_exec_i::PortStatusListener_exec_i (Atomic_ULong &lost) + : lost_ (lost) { } @@ -82,6 +87,7 @@ namespace CIAO_Hello_DDS_Receiver_Impl ::DDS::DataReader_ptr /* the_reader */, const ::DDS::SampleLostStatus & /* status */) { + ++lost_; printf ("port status listener::on_sample_lost\n"); } @@ -90,6 +96,10 @@ namespace CIAO_Hello_DDS_Receiver_Impl //============================================================ Receiver_exec_i::Receiver_exec_i (void) + : context_ (0), + expected_ (10), + received_ (0), + lost_ (0) { } @@ -101,18 +111,31 @@ namespace CIAO_Hello_DDS_Receiver_Impl // Component attributes. + ::CORBA::ULong + Receiver_exec_i::expected_samples (void) + { + return this->expected_; + } + + void + Receiver_exec_i::expected_samples (::CORBA::ULong expected_samples) + { + this->expected_ = expected_samples; + } + + // Port operations. ::CCM_DDS::CCM_string_RawListener_ptr Receiver_exec_i::get_read_message_listener (void) { - return new string_RawListener_exec_i (); + return new string_RawListener_exec_i (this->received_); } ::CCM_DDS::CCM_PortStatusListener_ptr Receiver_exec_i::get_read_message_status (void) { - return new PortStatusListener_exec_i (); + return new PortStatusListener_exec_i (this->lost_); } // Operations from Components::SessionComponent. @@ -151,7 +174,15 @@ namespace CIAO_Hello_DDS_Receiver_Impl void Receiver_exec_i::ccm_remove (void) { - /* Your code here. */ + CIAO_DEBUG ((LM_INFO, "Receiver_exec_i received %u messages and lost %u messages\n", + this->received_.value (), + this->lost_.value ())); + + if (this->received_ != this->expected_) + { + CIAO_ERROR ((LM_EMERGENCY, "Receiver_exec_i: ERROR: Expected to receive %u messages, actually got %u\n", + this->expected_, this->received_.value ())); + } } extern "C" HELLO_RECEIVER_EXEC_Export ::Components::EnterpriseComponent_ptr diff --git a/modules/CIAO/connectors/dds4ccm/examples/Hello/Receiver/Hello_Receiver_exec.h b/modules/CIAO/connectors/dds4ccm/examples/Hello/Receiver/Hello_Receiver_exec.h index 305de36e3dc..490f064867c 100644 --- a/modules/CIAO/connectors/dds4ccm/examples/Hello/Receiver/Hello_Receiver_exec.h +++ b/modules/CIAO/connectors/dds4ccm/examples/Hello/Receiver/Hello_Receiver_exec.h @@ -44,90 +44,103 @@ namespace CIAO_Hello_DDS_Receiver_Impl { + typedef ACE_Atomic_Op <ACE_Thread_Mutex, CORBA::ULong > Atomic_ULong; + class HELLO_RECEIVER_EXEC_Export string_RawListener_exec_i : public virtual ::CCM_DDS::CCM_string_RawListener, public virtual ::CORBA::LocalObject { public: - string_RawListener_exec_i (void); + string_RawListener_exec_i (Atomic_ULong &); virtual ~string_RawListener_exec_i (void); + + // Operations and attributes from ::CCM_DDS::string_RawListener - // Operations and attributes from ::CCM_DDS::string_RawListener + // TAO_IDL - Generated from + // be/be_visitor_operation/operation_ch.cpp:46 - // TAO_IDL - Generated from - // be/be_visitor_operation/operation_ch.cpp:46 + virtual void + on_data ( + const char * an_instance, + const ::CCM_DDS::ReadInfo & info); - virtual void - on_data ( - const char * an_instance, - const ::CCM_DDS::ReadInfo & info); - }; +private: + Atomic_ULong &received_; +}; - class HELLO_RECEIVER_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); +class HELLO_RECEIVER_EXEC_Export PortStatusListener_exec_i + : public virtual ::CCM_DDS::CCM_PortStatusListener, + public virtual ::CORBA::LocalObject +{ + public: + PortStatusListener_exec_i (Atomic_ULong &); + virtual ~PortStatusListener_exec_i (void); - // Operations and attributes from ::CCM_DDS::PortStatusListener + // Operations and attributes from ::CCM_DDS::PortStatusListener - // TAO_IDL - Generated from - // be/be_visitor_operation/operation_ch.cpp:46 + // TAO_IDL - Generated from + // be/be_visitor_operation/operation_ch.cpp:46 - virtual void + virtual void on_requested_deadline_missed ( - ::DDS::DataReader_ptr the_reader, - const ::DDS::RequestedDeadlineMissedStatus & status); + ::DDS::DataReader_ptr the_reader, + const ::DDS::RequestedDeadlineMissedStatus & status); - // TAO_IDL - Generated from - // be/be_visitor_operation/operation_ch.cpp:46 + // TAO_IDL - Generated from + // be/be_visitor_operation/operation_ch.cpp:46 - virtual void + virtual void on_sample_lost ( - ::DDS::DataReader_ptr the_reader, - const ::DDS::SampleLostStatus & status); - }; + ::DDS::DataReader_ptr the_reader, + const ::DDS::SampleLostStatus & status); + private: + Atomic_ULong &lost_; +}; - class HELLO_RECEIVER_EXEC_Export Receiver_exec_i - : public virtual Receiver_Exec, - public virtual ::CORBA::LocalObject - { - public: - Receiver_exec_i (void); - virtual ~Receiver_exec_i (void); +class HELLO_RECEIVER_EXEC_Export Receiver_exec_i + : public virtual Receiver_Exec, + public virtual ::CORBA::LocalObject +{ + public: + Receiver_exec_i (void); + virtual ~Receiver_exec_i (void); - // Supported operations and attributes. + // Supported operations and attributes. - // Component attributes. + // Component attributes. + virtual ::CORBA::ULong expected_samples (void); - // Port operations. + virtual void expected_samples (::CORBA::ULong expected_samples); + + // Port operations. - virtual ::CCM_DDS::CCM_string_RawListener_ptr + virtual ::CCM_DDS::CCM_string_RawListener_ptr get_read_message_listener (void); - virtual ::CCM_DDS::CCM_PortStatusListener_ptr + virtual ::CCM_DDS::CCM_PortStatusListener_ptr get_read_message_status (void); - // Operations from Components::SessionComponent. + // Operations from Components::SessionComponent. - virtual void + virtual void set_session_context ( - ::Components::SessionContext_ptr ctx); + ::Components::SessionContext_ptr ctx); - virtual void configuration_complete (void); + virtual void configuration_complete (void); - virtual void ccm_activate (void); - virtual void ccm_passivate (void); - virtual void ccm_remove (void); + virtual void ccm_activate (void); + virtual void ccm_passivate (void); + virtual void ccm_remove (void); - private: - ::Hello_DDS::CCM_Receiver_Context_var context_; - }; + private: + ::Hello_DDS::CCM_Receiver_Context_var context_; + CORBA::ULong expected_; + Atomic_ULong received_; + Atomic_ULong lost_; +}; - extern "C" HELLO_RECEIVER_EXEC_Export ::Components::EnterpriseComponent_ptr - create_Hello_DDS_Receiver_Impl (void); +extern "C" HELLO_RECEIVER_EXEC_Export ::Components::EnterpriseComponent_ptr +create_Hello_DDS_Receiver_Impl (void); } namespace CIAO_Hello_DDS_Receiver_Impl @@ -150,7 +163,7 @@ namespace CIAO_Hello_DDS_Receiver_Impl // Implicit operations. virtual ::Components::EnterpriseComponent_ptr - create (void); + create (void); }; extern "C" HELLO_RECEIVER_EXEC_Export ::Components::HomeExecutorBase_ptr |