diff options
Diffstat (limited to 'CIAO/connectors/dds4ccm/tests/SLOneByOne/Receiver/SL_OneByOne_Receiver_exec.cpp')
-rw-r--r-- | CIAO/connectors/dds4ccm/tests/SLOneByOne/Receiver/SL_OneByOne_Receiver_exec.cpp | 70 |
1 files changed, 43 insertions, 27 deletions
diff --git a/CIAO/connectors/dds4ccm/tests/SLOneByOne/Receiver/SL_OneByOne_Receiver_exec.cpp b/CIAO/connectors/dds4ccm/tests/SLOneByOne/Receiver/SL_OneByOne_Receiver_exec.cpp index d0c89b3fe80..e3ba1e99626 100644 --- a/CIAO/connectors/dds4ccm/tests/SLOneByOne/Receiver/SL_OneByOne_Receiver_exec.cpp +++ b/CIAO/connectors/dds4ccm/tests/SLOneByOne/Receiver/SL_OneByOne_Receiver_exec.cpp @@ -1,32 +1,7 @@ // -*- C++ -*- // $Id$ -/** - * Code generated by the The ACE ORB (TAO) IDL Compiler v1.8.3 - * 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 - * 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 - **/ - #include "SL_OneByOne_Receiver_exec.h" - #include "dds4ccm/impl/dds4ccm_conf.h" #define ON_CREATION_EXPECTED 4 @@ -39,13 +14,13 @@ namespace CIAO_SL_OneByOne_Receiver_Impl /** * Facet Executor Implementation Class: info_out_data_listener_exec_i */ - info_out_data_listener_exec_i::info_out_data_listener_exec_i ( ::SL_OneByOne::CCM_Receiver_Context_ptr ctx, Atomic_Long &on_many_updates, Atomic_Long &on_creation, Atomic_Long &on_one_update, Atomic_Long &on_deletion, + Atomic_Long &samples_read, ACE_Thread_ID &thread_id) : ciao_context_ ( ::SL_OneByOne::CCM_Receiver_Context::_duplicate (ctx)) @@ -53,6 +28,7 @@ namespace CIAO_SL_OneByOne_Receiver_Impl , on_creation_ (on_creation) , on_one_update_ (on_one_update) , on_deletion_ (on_deletion) + , samples_read_ (samples_read) , thread_id_ (thread_id) { } @@ -104,6 +80,36 @@ namespace CIAO_SL_OneByOne_Receiver_Impl { ++this->on_one_update_; } + + // When we have received all updates, check if there is something + // left in the cache + if (this->on_one_update_.value () == ON_ONE_UPDATE_EXPECTED) + { + try + { + ::SL_OneByOne::SL_OneByOneConnector::Reader_var reader = + this->ciao_context_->get_connection_info_out_data (); + if (::CORBA::is_nil (reader.in ())) + { + ACE_ERROR ((LM_ERROR, "info_out_data_listener_exec_i::on_one_update - " + "ERROR: Reader seems nil\n")); + } + ::TestTopicSeq seq; + ::CCM_DDS::ReadInfoSeq infos; + reader->read_all (seq, infos); + this->samples_read_ += seq.length (); + + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("StateListener_exec_i::on_one_update - ") + ACE_TEXT ("Read <%u> samples\n"), + seq.length ())); + } + catch (const CCM_DDS::InternalError& ex) + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("ERROR: Internal Error ") + ACE_TEXT ("when using reader->read_all: index <%d> - retval <%d>\n"), + ex.index, ex.error_code)); + } + } } void @@ -200,6 +206,7 @@ namespace CIAO_SL_OneByOne_Receiver_Impl on_creation_ (0), on_one_update_ (0), on_deletion_ (0), + samples_read_ (0), thread_id_listener_ (0, 0) { } @@ -226,6 +233,7 @@ namespace CIAO_SL_OneByOne_Receiver_Impl this->on_creation_, this->on_one_update_, this->on_deletion_, + this->samples_read_, this->thread_id_listener_), ::SL_OneByOne::SL_OneByOneConnector::CCM_StateListener::_nil ()); @@ -295,7 +303,6 @@ namespace CIAO_SL_OneByOne_Receiver_Impl void Receiver_exec_i::ccm_passivate (void) { - /* Your code here. */ } void @@ -373,6 +380,15 @@ namespace CIAO_SL_OneByOne_Receiver_Impl ON_DELETION_EXPECTED, this->on_deletion_.value ())); } + if (this->samples_read_.value () == 0) + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("ERROR: read no samples\n"))); + } + else + { + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("OK: read <%u> samples\n"), + this->samples_read_.value ())); + } char ccm_buf [65]; ACE_Thread_ID ccm_thread_id; |