From d14694751aed983f826a6a32b9124f4d9f01069f Mon Sep 17 00:00:00 2001 From: dengg Date: Thu, 26 Oct 2006 04:20:52 +0000 Subject: Modified to send and receive valuetype data. --- TAO/orbsvcs/examples/RtEC/MCast/Consumer.cpp | 17 +++++++++++++++++ TAO/orbsvcs/examples/RtEC/MCast/RtEC_MCast.mpc | 3 +++ TAO/orbsvcs/examples/RtEC/MCast/Supplier.cpp | 7 +++++++ TAO/orbsvcs/examples/RtEC/MCast/Test.idl | 11 +++++++++++ 4 files changed, 38 insertions(+) create mode 100644 TAO/orbsvcs/examples/RtEC/MCast/Test.idl diff --git a/TAO/orbsvcs/examples/RtEC/MCast/Consumer.cpp b/TAO/orbsvcs/examples/RtEC/MCast/Consumer.cpp index b85abca57ee..0dad294cfd0 100644 --- a/TAO/orbsvcs/examples/RtEC/MCast/Consumer.cpp +++ b/TAO/orbsvcs/examples/RtEC/MCast/Consumer.cpp @@ -4,6 +4,8 @@ #include "orbsvcs/RtecEventChannelAdminS.h" #include "orbsvcs/Event_Service_Constants.h" +#include "TestC.h" + ACE_RCSID (EC_Examples, Consumer, "$Id$") @@ -88,6 +90,21 @@ Consumer::push (const RtecEventComm::EventSet& events } this->event_count_ += events.length (); + + for (size_t i = 0; i < events.length (); ++i) + { + ValueTypeData * test_data = 0; + if (events[i].data.any_value >>= test_data) + { + ACE_ERROR ((LM_ERROR, "Consumer (%P|%t): Received a message: %s\n", + test_data->data ())); + } + else + { + ACE_ERROR ((LM_ERROR, "Consumer (%P|%t): failed to extract valuetype data\n")); + } + } + if (this->event_count_ % 100 == 0) { ACE_DEBUG ((LM_DEBUG, diff --git a/TAO/orbsvcs/examples/RtEC/MCast/RtEC_MCast.mpc b/TAO/orbsvcs/examples/RtEC/MCast/RtEC_MCast.mpc index ebe69a8ddbc..f1bcd3bc85a 100644 --- a/TAO/orbsvcs/examples/RtEC/MCast/RtEC_MCast.mpc +++ b/TAO/orbsvcs/examples/RtEC/MCast/RtEC_MCast.mpc @@ -2,4 +2,7 @@ // $Id$ project : orbsvcsexe, rtevent_serv, rtsched { + IDL_Files { + Test.idl + } } diff --git a/TAO/orbsvcs/examples/RtEC/MCast/Supplier.cpp b/TAO/orbsvcs/examples/RtEC/MCast/Supplier.cpp index f835dcb6daa..b077fdf1cbd 100644 --- a/TAO/orbsvcs/examples/RtEC/MCast/Supplier.cpp +++ b/TAO/orbsvcs/examples/RtEC/MCast/Supplier.cpp @@ -4,6 +4,8 @@ #include "orbsvcs/RtecEventChannelAdminS.h" #include "orbsvcs/Event_Service_Constants.h" +#include "TestC.h" + ACE_RCSID (EC_Examples, Supplier, "$Id$") @@ -77,6 +79,11 @@ Supplier::perform_push (ACE_ENV_SINGLE_ARG_DECL) // Avoid loops throught the event channel federations event[0].header.ttl = 1; + OBV_ValueTypeData * test_data; + ACE_NEW (test_data, OBV_ValueTypeData ()); + test_data->data ("This is a test message"); + event[0].data.any_value <<= test_data; + this->proxy_->push (event ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; } diff --git a/TAO/orbsvcs/examples/RtEC/MCast/Test.idl b/TAO/orbsvcs/examples/RtEC/MCast/Test.idl new file mode 100644 index 00000000000..fc7e50d4fd2 --- /dev/null +++ b/TAO/orbsvcs/examples/RtEC/MCast/Test.idl @@ -0,0 +1,11 @@ +//$Id$: + +#ifndef TAO_RTEC_MCAST_TEST_IDL +#define TAO_RTEC_MCAST_TEST_IDL + +valuetype ValueTypeData +{ + public string data; +}; + +#endif /* TAO_RTEC_MCAST_TEST_IDL */ -- cgit v1.2.1