diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 1998-03-21 02:06:07 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 1998-03-21 02:06:07 +0000 |
commit | 748b3b3ab5f9d323a1824b30c3f597ed44f5388a (patch) | |
tree | 50e43748232eb77e00b9dd8bf10ba3d728f81655 | |
parent | 7506bde9b2c0ae89fb73995bc2c18d61d9146560 (diff) | |
download | ATCD-748b3b3ab5f9d323a1824b30c3f597ed44f5388a.tar.gz |
*** empty log message ***
-rw-r--r-- | ChangeLog-98a | 4 | ||||
-rw-r--r-- | TAO/examples/Simulator/Event_Supplier/Event_Con.cpp | 201 | ||||
-rw-r--r-- | TAO/examples/Simulator/Event_Supplier/Event_Con.h | 25 | ||||
-rw-r--r-- | TAO/examples/Simulator/Event_Supplier/Event_Sup.cpp | 685 | ||||
-rw-r--r-- | TAO/examples/Simulator/Event_Supplier/Event_Sup.h | 49 | ||||
-rw-r--r-- | TAO/examples/Simulator/NavWeap.idl | 87 | ||||
-rw-r--r-- | VERSION | 2 |
7 files changed, 522 insertions, 531 deletions
diff --git a/ChangeLog-98a b/ChangeLog-98a index 605ccfb3e51..d105721597d 100644 --- a/ChangeLog-98a +++ b/ChangeLog-98a @@ -1,7 +1,3 @@ -Fri Mar 20 19:47:34 1998 Douglas C. Schmidt <schmidt@cs.wustl.edu> - - * ACE version 4.4.34, released Fri Mar 20 19:47:34 1998. - Fri Mar 20 14:18:53 1998 Douglas C. Schmidt <schmidt@tango.cs.wustl.edu> * performance-tests/UDP/udp_test.cpp: Completed the ACE'ification diff --git a/TAO/examples/Simulator/Event_Supplier/Event_Con.cpp b/TAO/examples/Simulator/Event_Supplier/Event_Con.cpp index 5d53bbe9616..1c46bdc512f 100644 --- a/TAO/examples/Simulator/Event_Supplier/Event_Con.cpp +++ b/TAO/examples/Simulator/Event_Supplier/Event_Con.cpp @@ -1,11 +1,18 @@ // $Id$ -// + // ============================================================================ // -// // = FILENAME // Event_Con.cpp // +// = DESCRIPTION +// This demo just tests the basic functionality of the Event Service +// One Conumer which inherits from the Rtec Consumer. One Supplier +// with an internal Rtec Consumer and one internal Rtec Supplier. +// The internal Supplier is just a demo supplier because the +// architecture expects an supplier which has inherited from the +// Rtec Supplier. +// // = AUTHOR // originally // David Levine (levine@cs.wustl.edu) and @@ -13,23 +20,13 @@ // modified // Michael Kircher (mk1@cs.wustl.edu) // -// = DESCRIPTION -// This demo just tests the basic functionality of the Event Service -// One Conumer which inherits from the Rtec Consumer. -// One Supplier with an internal Rtec Consumer and one internal Rtec Supplier. -// The internal Supplier is just a demo supplier because the architecture -// expects an supplier which has inherited from the Rtec Supplier. -// // ============================================================================ - #include <limits.h> - #include "ace/Get_Opt.h" #include "ace/Sched_Params.h" #include "ace/Profile_Timer.h" - #include "tao/Timeprobe.h" #include "orbsvcs/Event_Utilities.h" #include "orbsvcs/Event_Service_Constants.h" @@ -38,9 +35,10 @@ #include "Event_Con.h" #include "NavWeapC.h" -#define SOURCE_ID 1001 +static const int SOURCE_ID = 1001; -static const char usage [] = "[-? |\n" +static const char usage [] = +"[-? |\n" " [-c <consumers> [4]]\n" " [-d directly connect all consumers/suppliers\n" " [-j to collect jitter statistics]\n" @@ -48,27 +46,29 @@ static const char usage [] = "[-? |\n" " [-s <suppliers>, [1]]\n" " [-t <timeout interval>, msec [250]]]"; - -int received = 0; - - +static int received = 0; // ************************************************************ -Demo_Consumer::Demo_Consumer (){} +Demo_Consumer::Demo_Consumer (void) +{ +} -int Demo_Consumer::open_consumer (RtecEventChannelAdmin::EventChannel_ptr ec, - const char *my_name) +int +Demo_Consumer::open_consumer (RtecEventChannelAdmin::EventChannel_ptr ec, + const char *my_name) { TAO_TRY { - // Get a Scheduler + // Get a Scheduler. - RtecScheduler::Scheduler_ptr server = ACE_Scheduler_Factory::server (); + RtecScheduler::Scheduler_ptr server = + ACE_Scheduler_Factory::server (); - // Define Real-time information + // Define Real-time information. rt_info_ = server->create (my_name, TAO_TRY_ENV); + server->set (rt_info_, ORBSVCS_Time::zero, ORBSVCS_Time::zero, @@ -86,26 +86,30 @@ int Demo_Consumer::open_consumer (RtecEventChannelAdmin::EventChannel_ptr ec, dependencies.insert_type (ACE_ES_EVENT_NOTIFICATION, rt_info_); dependencies.insert_type (ACE_ES_EVENT_SHUTDOWN, rt_info_); - // The channel administrator is the event channel we got from the invocation - // of this routine + // The channel administrator is the event channel we got from + // the invocation of this routine. this->channel_admin_ = ec; - // = Connect as a consumer + // = Connect as a consumer. - this->consumer_admin_ = channel_admin_->for_consumers (TAO_TRY_ENV); + this->consumer_admin_ = + channel_admin_->for_consumers (TAO_TRY_ENV); TAO_CHECK_ENV; - // Obtain a pointer to a push supplier - // "suppliers" is inherited from a base class + // Obtain a pointer to a push supplier. "suppliers" is + // inherited from a base class. - this->suppliers_ = consumer_admin_->obtain_push_supplier (TAO_TRY_ENV); + this->suppliers_ = + consumer_admin_->obtain_push_supplier (TAO_TRY_ENV); TAO_CHECK_ENV; // The _this function returns an object pointer. This is needed - // because a consumer inherits from a Servant class that is no CORBA::Object. + // because a consumer inherits from a Servant class that is no + // CORBA::Object. - RtecEventComm::PushConsumer_var objref = this->_this (TAO_TRY_ENV); + RtecEventComm::PushConsumer_var objref = + this->_this (TAO_TRY_ENV); TAO_CHECK_ENV; this->suppliers_->connect_push_consumer (objref.in (), @@ -116,12 +120,14 @@ int Demo_Consumer::open_consumer (RtecEventChannelAdmin::EventChannel_ptr ec, TAO_CATCH (RtecEventChannelAdmin::EventChannel::SUBSCRIPTION_ERROR, se) { ACE_ERROR_RETURN ((LM_ERROR, - "Demo_Consumer::open: subscribe failed.\n"), -1); + "Demo_Consumer::open: subscribe failed.\n"), + -1); } TAO_CATCHANY { ACE_ERROR_RETURN ((LM_ERROR, - "Demo_Consumer::open: unexpected exception.\n"), -1); + "Demo_Consumer::open: unexpected exception.\n"), + -1); } TAO_ENDTRY; @@ -131,7 +137,8 @@ int Demo_Consumer::open_consumer (RtecEventChannelAdmin::EventChannel_ptr ec, void Demo_Consumer::disconnect_push_consumer (CORBA::Environment &) { - ACE_DEBUG ((LM_DEBUG, "Consumer received disconnect from channel.\n")); + ACE_DEBUG ((LM_DEBUG, + "Consumer received disconnect from channel.\n")); } void @@ -198,7 +205,6 @@ Demo_Consumer::push (const RtecEventComm::EventSet &events, void Demo_Consumer::shutdown (void) { - TAO_TRY { // Disconnect from the push supplier. @@ -211,8 +217,6 @@ Demo_Consumer::shutdown (void) TAO_ORB_Core_instance ()->orb ()->shutdown (); TAO_CHECK_ENV; - - } TAO_CATCHANY { @@ -222,11 +226,6 @@ Demo_Consumer::shutdown (void) TAO_ENDTRY; } - - - - - // function get_options static unsigned int @@ -238,71 +237,74 @@ get_options (int argc, char *argv []) while ((opt = get_opt ()) != EOF) { - switch (opt) { - case '?': - ACE_DEBUG ((LM_DEBUG, - "Usage: %s %s\n", - argv[0], usage)); - ACE_OS::exit (0); - break; - default: - ACE_ERROR_RETURN ((LM_ERROR, - "%s: unknown arg, -%c\n" - "Usage: %s %s\n", - argv[0], char(opt), - argv[0], usage), 1); - } + switch (opt) + { + case '?': + ACE_DEBUG ((LM_DEBUG, + "Usage: %s %s\n", + argv[0], usage)); + ACE_OS::exit (0); + break; + default: + ACE_ERROR_RETURN ((LM_ERROR, + "%s: unknown arg, -%c\n" + "Usage: %s %s\n", + argv[0], char(opt), + argv[0], usage), 1); + } } if (argc != get_opt.optind) - { - ACE_ERROR_RETURN ((LM_ERROR, - "%s: too many arguments\n" - "Usage: %s %s\n", - argv[0], argv[0], usage), 1); - } - + ACE_ERROR_RETURN ((LM_ERROR, + "%s: too many arguments\n" + "Usage: %s %s\n", + argv[0], + argv[0], + usage), + 1); return 0; } - -// function main +// function main. int main (int argc, char *argv []) { - TAO_TRY { // Initialize ORB. - CORBA::ORB_var orb = CORBA::ORB_init (argc, argv, "internet", TAO_TRY_ENV); + CORBA::ORB_var orb = + CORBA::ORB_init (argc, argv, "internet", TAO_TRY_ENV); TAO_CHECK_ENV; - CORBA::Object_var poa_object = orb->resolve_initial_references("RootPOA"); + CORBA::Object_var poa_object = + orb->resolve_initial_references("RootPOA"); + if (CORBA::is_nil (poa_object.in ())) - { - ACE_ERROR_RETURN ((LM_ERROR, - " (%P|%t) Unable to initialize the POA.\n"), - 1); - } + ACE_ERROR_RETURN ((LM_ERROR, + " (%P|%t) Unable to initialize the POA.\n"), + 1); - PortableServer::POA_var root_poa = PortableServer::POA::_narrow (poa_object.in (), TAO_TRY_ENV); + PortableServer::POA_var root_poa = + PortableServer::POA::_narrow (poa_object.in (), TAO_TRY_ENV); TAO_CHECK_ENV; - PortableServer::POAManager_var poa_manager = root_poa->the_POAManager (TAO_TRY_ENV); + PortableServer::POAManager_var poa_manager = + root_poa->the_POAManager (TAO_TRY_ENV); TAO_CHECK_ENV; - CORBA::Object_var naming_obj = orb->resolve_initial_references ("NameService"); + CORBA::Object_var naming_obj = + orb->resolve_initial_references ("NameService"); + if (CORBA::is_nil (naming_obj.in ())) - { - ACE_ERROR_RETURN ((LM_ERROR, - " (%P|%t) Unable to initialize the POA.\n"), - 1); - } + ACE_ERROR_RETURN ((LM_ERROR, + " (%P|%t) Unable to initialize the POA.\n"), + 1); CosNaming::NamingContext_var naming_context = - CosNaming::NamingContext::_narrow (naming_obj.in (), TAO_TRY_ENV); + CosNaming::NamingContext::_narrow (naming_obj.in (), + TAO_TRY_ENV); TAO_CHECK_ENV; ACE_Scheduler_Factory::use_config (naming_context.in ()); @@ -310,30 +312,38 @@ main (int argc, char *argv []) if (get_options (argc, argv)) ACE_OS::exit (-1); - // Get the Event Channel + // Get the Event Channel. CosNaming::Name channel_name (1); channel_name.length (1); channel_name[0].id = CORBA::string_dup ("EventService"); - CORBA::Object_var ec_obj = naming_context->resolve (channel_name, TAO_TRY_ENV); + CORBA::Object_var ec_obj = + naming_context->resolve (channel_name, + TAO_TRY_ENV); TAO_CHECK_ENV; - RtecEventChannelAdmin::EventChannel_var ec = RtecEventChannelAdmin::EventChannel::_narrow (ec_obj.in(), TAO_TRY_ENV); TAO_CHECK_ENV; if (ec.ptr() == 0) - ACE_ERROR_RETURN ((LM_ERROR,"Not able to get the Event Service reference.\n"), -1); + ACE_ERROR_RETURN ((LM_ERROR, + "Not able to get the Event Service reference.\n"), + -1); // Create consumer. Demo_Consumer *demo_consumer; - ACE_NEW_RETURN (demo_consumer, Demo_Consumer (), -1); + ACE_NEW_RETURN (demo_consumer, + Demo_Consumer (), + -1); - if (demo_consumer->open_consumer (ec.ptr (), "demo_consumer") == -1) - ACE_ERROR_RETURN ((LM_ERROR, "Someone was feeling introverted.\n"), -1); + if (demo_consumer->open_consumer (ec.ptr (), + "demo_consumer") == -1) + ACE_ERROR_RETURN ((LM_ERROR, + "Someone was feeling introverted.\n"), + -1); poa_manager->activate (TAO_TRY_ENV); TAO_CHECK_ENV; @@ -341,8 +351,10 @@ main (int argc, char *argv []) // Run the ORB if (orb->run () == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "CORBA::ORB::run"), -1); - + ACE_ERROR_RETURN ((LM_ERROR, + "%p\n", + "CORBA::ORB::run"), + -1); TAO_CHECK_ENV; delete demo_consumer; @@ -350,8 +362,6 @@ main (int argc, char *argv []) root_poa->destroy (CORBA::B_TRUE, CORBA::B_TRUE, TAO_TRY_ENV); - - TAO_CHECK_ENV; } @@ -361,6 +371,5 @@ main (int argc, char *argv []) } TAO_ENDTRY; - return 0; } diff --git a/TAO/examples/Simulator/Event_Supplier/Event_Con.h b/TAO/examples/Simulator/Event_Supplier/Event_Con.h index caf96315461..c95efa7f473 100644 --- a/TAO/examples/Simulator/Event_Supplier/Event_Con.h +++ b/TAO/examples/Simulator/Event_Supplier/Event_Con.h @@ -1,7 +1,6 @@ // $Id$ -// + // ============================================================================ -// // // = FILENAME // Event_Con.h @@ -13,9 +12,6 @@ // modified // Michael Kircher (mk1@cs.wustl.edu) // -// = DESCRIPTION -// -// // ============================================================================ #if !defined (EVENT_CON_H) @@ -26,15 +22,15 @@ #include "orbsvcs/RtecEventCommS.h" class Demo_Consumer : public POA_RtecEventComm::PushConsumer -// = TITLE -// Demo Consumer -// -// = DESCRIPTION -// Simple example of a consumer that registers for supplier -// notifications. { + // = TITLE + // Demo Consumer + // + // = DESCRIPTION + // Simple example of a consumer that registers for supplier + // notifications. public: - Demo_Consumer (); + Demo_Consumer (void); int open_consumer (RtecEventChannelAdmin::EventChannel_ptr ec, const char *my_name); @@ -47,7 +43,7 @@ public: virtual void disconnect_push_consumer (CORBA::Environment &); // The channel is disconnecting. -// (not protected to allow short-circuiting) protected: + // = (not protected to allow short-circuiting) protected: virtual void push (const RtecEventComm::EventSet &events, CORBA::Environment &); // If the <events>[0] is a notification, prints out the data from @@ -65,9 +61,6 @@ protected: private: RtecScheduler::handle_t rt_info_; - }; - - #endif /* EVENT_CON_H */ diff --git a/TAO/examples/Simulator/Event_Supplier/Event_Sup.cpp b/TAO/examples/Simulator/Event_Supplier/Event_Sup.cpp index a1dbc3aefc2..47248a365b6 100644 --- a/TAO/examples/Simulator/Event_Supplier/Event_Sup.cpp +++ b/TAO/examples/Simulator/Event_Supplier/Event_Sup.cpp @@ -1,11 +1,13 @@ // $Id$ -// + // ============================================================================ // -// // = FILENAME // Event_Sup.cpp // +// = DESCRIPTION +// Event Supplier for the flight simulator +// // = AUTHOR // originally // David Levine (levine@cs.wustl.edu) and @@ -13,20 +15,14 @@ // modified // Michael Kircher (mk1@cs.wustl.edu) // -// = DESCRIPTION -// Event Supplier for the flight simulator -// // ============================================================================ - #include <limits.h> - #include "ace/Get_Opt.h" #include "ace/Sched_Params.h" #include "ace/Profile_Timer.h" #include "ace/OS.h" - #include "tao/Timeprobe.h" #include "tao/corba.h" #include "orbsvcs/Event_Utilities.h" @@ -36,38 +32,39 @@ #include "Event_Sup.h" #include "NavWeapC.h" -#define SOURCE_ID 1001 +const int SOURCE_ID = 1001; -static const char usage [] = "[-? |\n" +static const char usage [] = +"[-? |\n" " [-O[RBport] ORB port number]" " [-m <count> of messages to send [100]]" " [-f name of schedler input data file]]"; -unsigned int total_messages = 100; +static u_int total_messages = 100; -char *input_file_name = 0; +static char *input_file_name = 0; // ------------ Internal_Demo_Consumer --------------------------------- - - Demo_Supplier::Internal_Demo_Consumer::Internal_Demo_Consumer (Demo_Supplier *impl) : impl_ (impl) { } - void Demo_Supplier::Internal_Demo_Consumer::push (const RtecEventComm::EventSet &events, - CORBA::Environment &env) + CORBA::Environment &env) { this->impl_->push (events, env); - ACE_DEBUG ((LM_DEBUG, "Internal Demo Consumer received push.\n")); + + ACE_DEBUG ((LM_DEBUG, + "Internal Demo Consumer received push.\n")); } void -Demo_Supplier::Internal_Demo_Consumer::disconnect_push_consumer (CORBA::Environment &) { } - +Demo_Supplier::Internal_Demo_Consumer::disconnect_push_consumer (CORBA::Environment &) +{ +} // -------------------- Internal Demo Supplier ----------------------------- @@ -77,14 +74,13 @@ Demo_Supplier::Internal_Demo_Supplier::Internal_Demo_Supplier (Demo_Supplier *im } void -Demo_Supplier::Internal_Demo_Supplier::disconnect_push_supplier (CORBA::Environment &) { } - - +Demo_Supplier::Internal_Demo_Supplier::disconnect_push_supplier (CORBA::Environment &) +{ +} // ---------------------------------------------------------------------------- - -Demo_Supplier::Demo_Supplier (unsigned int supplier_id) +Demo_Supplier::Demo_Supplier (u_int supplier_id) : supplier_id_ (supplier_id), internal_demo_consumer_ (new Internal_Demo_Consumer (this)), internal_demo_supplier_ (new Internal_Demo_Supplier (this)) @@ -99,22 +95,21 @@ Demo_Supplier::~Demo_Supplier (void) int Demo_Supplier::open_supplier (RtecEventChannelAdmin::EventChannel_ptr ec, - const char *name) + const char *name) { - TAO_TRY { this->channel_admin_ = ec; - // Get a Scheduling server - - RtecScheduler::Scheduler_ptr scheduler_ = ACE_Scheduler_Factory::server (); + // Get a Scheduling server. + RtecScheduler::Scheduler_ptr scheduler_ = + ACE_Scheduler_Factory::server (); - // Generate the Real-time information - - this->rt_info_ = scheduler_->create (name, TAO_TRY_ENV); + // Generate the Real-time information. + this->rt_info_ = scheduler_->create (name, + TAO_TRY_ENV); scheduler_->set (rt_info_, ORBSVCS_Time::zero, ORBSVCS_Time::zero, @@ -126,7 +121,7 @@ Demo_Supplier::open_supplier (RtecEventChannelAdmin::EventChannel_ptr ec, TAO_TRY_ENV); TAO_CHECK_ENV; - // Set the publications to report them to the event channel + // Set the publications to report them to the event channel. CORBA::Short x = 0; RtecEventChannelAdmin::SupplierQOS qos_; @@ -134,46 +129,55 @@ Demo_Supplier::open_supplier (RtecEventChannelAdmin::EventChannel_ptr ec, qos_.publications_[0].event_.source_ = SOURCE_ID; qos_.publications_[0].event_.type_ = ACE_ES_EVENT_NOTIFICATION; qos_.publications_[0].event_.ttl_ = 1; - qos_.publications_[0].event_.creation_time_ = ORBSVCS_Time::zero; // default values + qos_.publications_[0].event_.creation_time_ = ORBSVCS_Time::zero; + // default values qos_.publications_[0].event_.ec_recv_time_ = ORBSVCS_Time::zero; qos_.publications_[0].event_.ec_send_time_ = ORBSVCS_Time::zero; qos_.publications_[0].event_.data_.x = 0; qos_.publications_[0].event_.data_.y = 0; - qos_.publications_[0].event_.data_.any_value.replace (CORBA::_tc_short, &x, 0, TAO_TRY_ENV); + qos_.publications_[0].event_.data_.any_value.replace (CORBA::_tc_short, + &x, + 0, + TAO_TRY_ENV); qos_.publications_[0].dependency_info_.number_of_calls = 1; qos_.publications_[0].dependency_info_.rt_info = rt_info_; qos_.publications_[1].event_.source_ = SOURCE_ID; qos_.publications_[1].event_.type_ = ACE_ES_EVENT_SHUTDOWN; qos_.publications_[1].event_.ttl_ = 1; - qos_.publications_[1].event_.creation_time_ = ORBSVCS_Time::zero; //default values + qos_.publications_[1].event_.creation_time_ = ORBSVCS_Time::zero; + // default values. qos_.publications_[1].event_.ec_recv_time_ = ORBSVCS_Time::zero; qos_.publications_[1].event_.ec_send_time_ = ORBSVCS_Time::zero; qos_.publications_[1].event_.data_.x = 0; qos_.publications_[1].event_.data_.y = 0; - qos_.publications_[1].event_.data_.any_value.replace (CORBA::_tc_short, &x, 0, TAO_TRY_ENV); + qos_.publications_[1].event_.data_.any_value.replace (CORBA::_tc_short, + &x, + 0, + TAO_TRY_ENV); qos_.publications_[1].dependency_info_.number_of_calls = 1; qos_.publications_[1].dependency_info_.rt_info = rt_info_; - // = Connect as a supplier. this->supplier_admin_ = channel_admin_->for_suppliers (TAO_TRY_ENV); TAO_CHECK_ENV; - this->proxy_consumer_ = supplier_admin_->obtain_push_consumer (TAO_TRY_ENV); + this->proxy_consumer_ = + supplier_admin_->obtain_push_consumer (TAO_TRY_ENV); TAO_CHECK_ENV; - // In calling _this we get back an object reference and register the servant with - // the POA - RtecEventComm::PushSupplier_var objref = this->internal_demo_supplier_->_this (TAO_TRY_ENV); + // In calling _this we get back an object reference and register + // the servant with the POA. + + RtecEventComm::PushSupplier_var objref = + this->internal_demo_supplier_->_this (TAO_TRY_ENV); TAO_CHECK_ENV; - // Connect the supplier to the proxy consumer + // Connect the supplier to the proxy consumer. this->proxy_consumer_->connect_push_supplier (objref.in (), qos_, TAO_TRY_ENV); TAO_CHECK_ENV; - } TAO_CATCHANY { @@ -185,64 +189,65 @@ Demo_Supplier::open_supplier (RtecEventChannelAdmin::EventChannel_ptr ec, return 0; } - - void Demo_Supplier::disconnect_push_supplier (CORBA::Environment &) { - ACE_DEBUG ((LM_DEBUG, "Supplier received disconnect from channel.\n")); + ACE_DEBUG ((LM_DEBUG, + "Supplier received disconnect from channel.\n")); } - - - void Demo_Supplier::start_generating_events (void) { - unsigned int total_sent_ = 0; + u_int total_sent_ = 0; - // load the scheduling data for the simulation + // Load the scheduling data for the simulation. ACE_Unbounded_Queue<Schedule_Viewer_Data *> schedule_data; this->load_schedule_data (schedule_data); ACE_Unbounded_Queue_Iterator<Schedule_Viewer_Data *> schedule_iter (schedule_data); if (schedule_iter.done ()) - { - ACE_ERROR ((LM_ERROR, - "Demo_Supplier::start_generating_events: " - "there is no scheduling data\n")); - return; - } + { + ACE_ERROR ((LM_ERROR, + "Demo_Supplier::start_generating_events: " + "there is no scheduling data\n")); + return; + } TAO_TRY { - do { - RtecEventComm::Event event; - event.source_ = SOURCE_ID; - event.type_ = ACE_ES_EVENT_NOTIFICATION; - event.ttl_ = 1; - event.creation_time_ = ORBSVCS_Time::zero; - event.ec_recv_time_ = ORBSVCS_Time::zero; - event.ec_send_time_ = ORBSVCS_Time::zero; - event.data_.x = 0; - event.data_.y = 0; - - this->insert_event_data (event.data_.any_value, schedule_iter); - - RtecEventComm::EventSet events; - events.length (1); - events[0] = event; - - proxy_consumer_->push (events, TAO_TRY_ENV); - TAO_CHECK_ENV; - - if (total_sent_ < 5) - ACE_DEBUG ((LM_DEBUG, "Pushing event data.\n")); - else if (total_sent_ == 5) - ACE_DEBUG ((LM_DEBUG, "Everything is running. Going to be mute.\n")); - } while (++total_sent_ < total_messages); - + do + { + RtecEventComm::Event event; + event.source_ = SOURCE_ID; + event.type_ = ACE_ES_EVENT_NOTIFICATION; + event.ttl_ = 1; + event.creation_time_ = ORBSVCS_Time::zero; + event.ec_recv_time_ = ORBSVCS_Time::zero; + event.ec_send_time_ = ORBSVCS_Time::zero; + event.data_.x = 0; + event.data_.y = 0; + + this->insert_event_data (event.data_.any_value, + schedule_iter); + + RtecEventComm::EventSet events; + events.length (1); + events[0] = event; + + proxy_consumer_->push (events, + TAO_TRY_ENV); + TAO_CHECK_ENV; + + if (total_sent_ < 5) + ACE_DEBUG ((LM_DEBUG, + "Pushing event data.\n")); + else if (total_sent_ == 5) + ACE_DEBUG ((LM_DEBUG, + "Everything is running. Going to be mute.\n")); + } + while (++total_sent_ < total_messages); // Sending a shutdown event -- not wanted right now /* RtecEventComm::Event event; @@ -273,101 +278,84 @@ Demo_Supplier::start_generating_events (void) // clean up the scheduling data Schedule_Viewer_Data **data_temp; - for (schedule_iter.first (); schedule_iter.done () == 0; schedule_iter.advance ()) - { - if ((schedule_iter.next (data_temp)) && (data_temp)) - { + for (schedule_iter.first (); + schedule_iter.done () == 0; + schedule_iter.advance ()) + if (schedule_iter.next (data_temp) && data_temp) delete (*data_temp); - } - } this->shutdown (); } - void -Demo_Supplier::load_schedule_data ( - ACE_Unbounded_Queue<Schedule_Viewer_Data *> &schedule_data) +Demo_Supplier::load_schedule_data + (ACE_Unbounded_Queue<Schedule_Viewer_Data *> &schedule_data) { Schedule_Viewer_Data *data = 0; if (input_file_name) - { - // open the scheduler data input file and read its contents into a queue - FILE *input_file; - int scan_count = 0; - input_file = ACE_OS::fopen(input_file_name, "r"); - if (input_file) { - // get a line at a time from the data file and parse it - char input_buf[BUFSIZ]; - while (ACE_OS::fgets (input_buf, BUFSIZ, input_file)) - { - // run through leading whitespace - char *temp = input_buf; - while ((*temp) && (isspace (*temp))) + // Open the scheduler data input file and read its contents into + // a queue. + FILE *input_file; + + int scan_count = 0; + input_file = ACE_OS::fopen(input_file_name, "r"); + + if (input_file) { - ++temp; + // Get a line at a time from the data file and parse it. + char input_buf[BUFSIZ]; + while (ACE_OS::fgets (input_buf, BUFSIZ, input_file)) + { + // Run through leading whitespace. + char *temp = input_buf; + while (*temp && isspace (*temp)) + ++temp; + + // If there is anything besides whitespace in the line + // read, scan its fields into the scheduling data + // structure. + if (ACE_OS::strlen (temp) > 0) + { + ACE_NEW (data, Schedule_Viewer_Data); + scan_count = sscanf (temp, "%s %lf %lf %lu %lu %lu %lu", + &(data->operation_name), &(data->utilitzation), + &(data->overhead), &(data->arrival_time), + &(data->deadline_time), &(data->completion_time), + &(data->computation_time)); + if (scan_count != 7) + { + ACE_ERROR ((LM_ERROR, + "Demo_Supplier::start_generating_events: " + "scanned incorrect number of data elements: %d\n", scan_count)); + + delete data; + return; + } + + // Insert the data into the queue. + schedule_data.enqueue_tail (data); + } + } } - - // if there is anything besides whitespace in the line read, - // scan its fields into the scheduling data structure - if (ACE_OS::strlen (temp) > 0) + else { - ACE_NEW (data, Schedule_Viewer_Data); - if (! data) - { - ACE_ERROR ((LM_ERROR, - "Demo_Supplier::start_generating_events: " - "memory allocation for scheduling data failed\n")); - return; - } - - scan_count = sscanf (temp, "%s %lf %lf %lu %lu %lu %lu", - &(data->operation_name), &(data->utilitzation), - &(data->overhead), &(data->arrival_time), - &(data->deadline_time), &(data->completion_time), - &(data->computation_time)); - if (scan_count != 7) - { - ACE_ERROR ((LM_ERROR, - "Demo_Supplier::start_generating_events: " - "scanned incorrect number of data elements: %d\n", scan_count)); - - delete data; - return; - } - - // insert the data into the queue - schedule_data.enqueue_tail (data); + ACE_ERROR ((LM_ERROR, + "Demo_Supplier::start_generating_events: " + "could not open input file [%s].\n", + input_file_name)); + return; } - } - } - else - { - ACE_ERROR ((LM_ERROR, - "Demo_Supplier::start_generating_events: " - "could not open input file [%s].\n", - input_file_name)); - return; } - } else { u_long last_completion = 0; - // just create 10 dummy scheduling records and use them + // Just create 10 dummy scheduling records and use them. for (int i = 0; i < 10; ++i) { ACE_NEW (data, Schedule_Viewer_Data); - if (! data) - { - ACE_ERROR ((LM_ERROR, - "Demo_Supplier::start_generating_events: " - "memory allocation for scheduling data failed\n")); - return; - } - char *oper_name = 0; switch (i % 4) @@ -390,13 +378,15 @@ Demo_Supplier::load_schedule_data ( break; } - strncpy(data->operation_name, oper_name, BUFSIZ-1); + ACE_OS::strncpy (data->operation_name, + oper_name, + BUFSIZ-1); - data->utilitzation = ((double)(ACE_OS::rand() %100))/100.0; - data->overhead = ((double)(ACE_OS::rand() %20))/100.0; + data->utilitzation = ((double)(ACE_OS::rand() %100)) / 100.0; + data->overhead = ((double)(ACE_OS::rand() %20)) / 100.0; data->arrival_time = ACE_OS::rand() % 200; - data->computation_time = (ACE_OS::rand() % 100)+10; + data->computation_time = (ACE_OS::rand() % 100) + 10; data->completion_time = last_completion + (ACE_OS::rand() % 100) + 100; data->completion_time = @@ -408,18 +398,18 @@ Demo_Supplier::load_schedule_data ( data->deadline_time = data->completion_time + (ACE_OS::rand() % 200) - 50; - // insert the data into the queue - schedule_data.enqueue_tail (data); - } + // insert the data into the queue. + schedule_data.enqueue_tail (data); + } } } // This function fills in the random data into the anys transported by -// the event channel +// the event channel. + void -Demo_Supplier::insert_event_data ( - CORBA::Any &data, - ACE_Unbounded_Queue_Iterator<Schedule_Viewer_Data *> &schedule_iter) +Demo_Supplier::insert_event_data (CORBA::Any &data, + ACE_Unbounded_Queue_Iterator<Schedule_Viewer_Data *> &schedule_iter) { static u_long last_completion = 0; @@ -427,96 +417,93 @@ Demo_Supplier::insert_event_data ( { Schedule_Viewer_Data **sched_data; - if ((schedule_iter.next (sched_data)) && (sched_data) && (*sched_data)) - { - if ((strcmp((*sched_data)->operation_name, "high_20") == 0) || - (strcmp((*sched_data)->operation_name, "low_20") == 0) || - (strcmp((*sched_data)->operation_name, "high_1") == 0) || - (strcmp((*sched_data)->operation_name, "low_1") == 0)) - { - navigation_.position_latitude = ACE_OS::rand() % 90; - navigation_.position_longitude = ACE_OS::rand() % 180; - navigation_.altitude = ACE_OS::rand() % 100; - navigation_.heading = ACE_OS::rand() % 180; - navigation_.roll = (navigation_.roll == 180) ? -180 : navigation_.roll + 1; - navigation_.pitch = (navigation_.pitch == 90) ? -90 : navigation_.pitch + 1; - - navigation_.utilitzation = (*sched_data)->utilitzation; - navigation_.overhead = (*sched_data)->overhead; - navigation_.arrival_time = (*sched_data)->arrival_time; - navigation_.deadline_time = (*sched_data)->deadline_time; - navigation_.completion_time = (*sched_data)->completion_time; - navigation_.computation_time = (*sched_data)->computation_time; - - // because sched_data does not contain utilization and overhead data - navigation_.utilitzation = ACE_OS::rand() % 100; - navigation_.overhead = ACE_OS::rand() % 20; - - data.replace (_tc_Navigation, &navigation_, CORBA::B_TRUE, TAO_TRY_ENV); - } - else if ((strcmp((*sched_data)->operation_name, "high_10") == 0) || - (strcmp((*sched_data)->operation_name, "low_10") == 0) || - (strcmp((*sched_data)->operation_name, "high_5") == 0) || - (strcmp((*sched_data)->operation_name, "low_5") == 0)) - { - weapons_.number_of_weapons = 2; - weapons_.weapon1_identifier = CORBA::string_alloc (30); - strcpy (weapons_.weapon1_identifier,"Photon Torpedoes"); - weapons_.weapon1_status =(ACE_OS::rand() % 4) == 0 ? 0 : 1 ; - weapons_.weapon2_identifier = CORBA::string_alloc (30); - strcpy (weapons_.weapon2_identifier,"Quantum Torpedoes"); - weapons_.weapon2_status = (ACE_OS::rand() % 4) == 0 ? 0 : 1; - weapons_.weapon3_identifier = CORBA::string_alloc (1); - strcpy (weapons_.weapon3_identifier, ""); - weapons_.weapon3_status = 0; - weapons_.weapon4_identifier = CORBA::string_alloc (1); - strcpy (weapons_.weapon4_identifier, ""); - weapons_.weapon4_status = 0; - weapons_.weapon5_identifier = CORBA::string_alloc (1); - strcpy (weapons_.weapon5_identifier, ""); - weapons_.weapon5_status = 0; - - weapons_.utilitzation = (*sched_data)->utilitzation; - weapons_.overhead = (*sched_data)->overhead; - weapons_.arrival_time = (*sched_data)->arrival_time; - weapons_.deadline_time = (*sched_data)->deadline_time; - weapons_.completion_time = (*sched_data)->completion_time; - weapons_.computation_time = (*sched_data)->computation_time; - - // because sched_data does not contain utilization and overhead data - weapons_.utilitzation = ACE_OS::rand() % 100; - weapons_.overhead = ACE_OS::rand() % 20; - - data.replace (_tc_Weapons, &weapons_, CORBA::B_TRUE, TAO_TRY_ENV); - } - else - { - ACE_ERROR ((LM_ERROR, "Demo_Supplier::insert_event_data: unrecognized operation name [%s]", - (*sched_data)->operation_name)); - } - - if (last_completion > (*sched_data)->completion_time) + if (schedule_iter.next (sched_data) && sched_data && *sched_data) { - last_completion = 0; + if ((ACE_OS::strcmp ((*sched_data)->operation_name, "high_20") == 0) + || (ACE_OS::strcmp ((*sched_data)->operation_name, "low_20") == 0) + || (ACE_OS::strcmp ((*sched_data)->operation_name, "high_1") == 0) + || (ACE_OS::strcmp ((*sched_data)->operation_name, "low_1") == 0)) + { + navigation_.position_latitude = ACE_OS::rand() % 90; + navigation_.position_longitude = ACE_OS::rand() % 180; + navigation_.altitude = ACE_OS::rand() % 100; + navigation_.heading = ACE_OS::rand() % 180; + navigation_.roll = (navigation_.roll == 180) ? -180 : navigation_.roll + 1; + navigation_.pitch = (navigation_.pitch == 90) ? -90 : navigation_.pitch + 1; + + navigation_.utilitzation = (*sched_data)->utilitzation; + navigation_.overhead = (*sched_data)->overhead; + navigation_.arrival_time = (*sched_data)->arrival_time; + navigation_.deadline_time = (*sched_data)->deadline_time; + navigation_.completion_time = (*sched_data)->completion_time; + navigation_.computation_time = (*sched_data)->computation_time; + + // Because sched_data does not contain utilization and + // overhead data. + navigation_.utilitzation = ACE_OS::rand() % 100; + navigation_.overhead = ACE_OS::rand() % 20; + + data.replace (_tc_Navigation, &navigation_, CORBA::B_TRUE, TAO_TRY_ENV); + } + else if ((ACE_OS::strcmp ((*sched_data)->operation_name, "high_10") == 0) + || (ACE_OS::strcmp ((*sched_data)->operation_name, "low_10") == 0) + || (ACE_OS::strcmp ((*sched_data)->operation_name, "high_5") == 0) + || (ACE_OS::strcmp ((*sched_data)->operation_name, "low_5") == 0)) + { + weapons_.number_of_weapons = 2; + weapons_.weapon1_identifier = CORBA::string_alloc (30); + ACE_OS::strcpy (weapons_.weapon1_identifier,"Photon Torpedoes"); + weapons_.weapon1_status =(ACE_OS::rand() % 4) == 0 ? 0 : 1 ; + weapons_.weapon2_identifier = CORBA::string_alloc (30); + ACE_OS::strcpy (weapons_.weapon2_identifier,"Quantum Torpedoes"); + weapons_.weapon2_status = (ACE_OS::rand() % 4) == 0 ? 0 : 1; + weapons_.weapon3_identifier = CORBA::string_alloc (1); + ACE_OS::strcpy (weapons_.weapon3_identifier, ""); + weapons_.weapon3_status = 0; + weapons_.weapon4_identifier = CORBA::string_alloc (1); + ACE_OS::strcpy (weapons_.weapon4_identifier, ""); + weapons_.weapon4_status = 0; + weapons_.weapon5_identifier = CORBA::string_alloc (1); + ACE_OS::strcpy (weapons_.weapon5_identifier, ""); + weapons_.weapon5_status = 0; + + weapons_.utilitzation = (*sched_data)->utilitzation; + weapons_.overhead = (*sched_data)->overhead; + weapons_.arrival_time = (*sched_data)->arrival_time; + weapons_.deadline_time = (*sched_data)->deadline_time; + weapons_.completion_time = (*sched_data)->completion_time; + weapons_.computation_time = (*sched_data)->computation_time; + + // Because sched_data does not contain utilization and + // overhead data. + weapons_.utilitzation = ACE_OS::rand() % 100; + weapons_.overhead = ACE_OS::rand() % 20; + + data.replace (_tc_Weapons, &weapons_, CORBA::B_TRUE, TAO_TRY_ENV); + } + else + ACE_ERROR ((LM_ERROR, "Demo_Supplier::insert_event_data: unrecognized operation name [%s]", + (*sched_data)->operation_name)); + + if (last_completion > (*sched_data)->completion_time) + last_completion = 0; + + if ((*sched_data)->completion_time >= last_completion) + { + ACE_Time_Value pause (0, + (*sched_data)->completion_time - last_completion); + ACE_OS::sleep (pause); + last_completion = (*sched_data)->completion_time; + } } - - if ((*sched_data)->completion_time >= last_completion) - { - ACE_Time_Value pause (0, (*sched_data)->completion_time - last_completion); - ACE_OS::sleep (pause); - last_completion = (*sched_data)->completion_time; - } - } else - { - ACE_ERROR ((LM_ERROR, "Demo_Supplier::insert_event_data: Could Not access scheduling data")); - } + ACE_ERROR ((LM_ERROR, + "Demo_Supplier::insert_event_data: Could Not access scheduling data")); schedule_iter.advance (); + if (schedule_iter.done ()) - { schedule_iter.first (); - } } TAO_CATCHANY { @@ -527,15 +514,13 @@ Demo_Supplier::insert_event_data ( void Demo_Supplier::push (const RtecEventComm::EventSet &events, - CORBA::Environment &env) + CORBA::Environment &env) { - } void Demo_Supplier::shutdown (void) { - TAO_TRY { // @@ Had problems with the next command, the application got stuck in it @@ -555,121 +540,125 @@ Demo_Supplier::shutdown (void) TAO_ENDTRY; } +// Function get_options. - - -// function get_options - -static unsigned int -get_options (int argc, char *argv []) +static u_int +get_options (int argc, + char *argv []) { - // We need the 'O' in get_opt() because we also want to have ORB parameters, they - // all start with 'O' + // We need the 'O' in get_opt() because we also want to have ORB + // parameters, they all start with 'O'. ACE_Get_Opt get_opt (argc, argv, "O?m:f:"); int opt; int temp; while ((opt = get_opt ()) != EOF) - { - switch (opt) { - case '?': - ACE_DEBUG ((LM_DEBUG, - "Usage: %s %s\n", - argv[0], usage)); - ACE_OS::exit (0); - break; - case 'm': - if ((temp = ACE_OS::atoi (get_opt.optarg)) > 0) - { - total_messages = (u_int) temp; - cout << "Messages to send:" << total_messages << endl; - } - else - { - ACE_ERROR_RETURN ((LM_ERROR, - "%s: count must be > 0", - argv[0]), 1); - } - break; - case 'f': - input_file_name = get_opt.optarg; - if ((! input_file_name) || (ACE_OS::strlen (input_file_name)) > 0) - { - cout << "Messages to send:" << total_messages << endl; - } - else + { + switch (opt) { - input_file_name = 0; + case '?': + ACE_DEBUG ((LM_DEBUG, + "Usage: %s %s\n", + argv[0], usage)); + ACE_OS::exit (0); + break; + case 'm': + temp = ACE_OS::atoi (get_opt.optarg); + if (temp > 0) + { + total_messages = (u_int) temp; + cout << "Messages to send:" << total_messages << endl; + } + else + ACE_ERROR_RETURN ((LM_ERROR, + "%s: count must be > 0", + argv[0]), + 1); + break; + case 'f': + input_file_name = get_opt.optarg; + + if (!input_file_name || ACE_OS::strlen (input_file_name) > 0) + cout << "Messages to send:" << total_messages << endl; + else + { + input_file_name = 0; + ACE_ERROR_RETURN ((LM_ERROR, + "%s: file name must be specified with -f option", + argv[0]), + 1); + } + break; + default: ACE_ERROR_RETURN ((LM_ERROR, - "%s: file name must be specified with -f option", - argv[0]), 1); + "%s: unknown arg, -%c\n" + "Usage: %s %s\n", + argv[0], char(opt), + argv[0], + usage), + 1); } - break; - default: - ACE_ERROR_RETURN ((LM_ERROR, - "%s: unknown arg, -%c\n" - "Usage: %s %s\n", - argv[0], char(opt), - argv[0], usage), 1); } - } if (argc != get_opt.optind) - { - ACE_ERROR_RETURN ((LM_ERROR, - "%s: too many arguments\n" - "Usage: %s %s\n", - argv[0], argv[0], usage), 1); - } + ACE_ERROR_RETURN ((LM_ERROR, + "%s: too many arguments\n" + "Usage: %s %s\n", + argv[0], + argv[0], + usage), + 1); return 0; } - - // function main int main (int argc, char *argv []) { - TAO_TRY { // Initialize ORB. - CORBA::ORB_var orb = CORBA::ORB_init (argc, argv, "internet", TAO_TRY_ENV); + CORBA::ORB_var orb = + CORBA::ORB_init (argc, + argv, + "internet", + TAO_TRY_ENV); TAO_CHECK_ENV; - // Connect to the RootPOA - CORBA::Object_var poa_object = orb->resolve_initial_references("RootPOA"); + // Connect to the RootPOA. + CORBA::Object_var poa_object = + orb->resolve_initial_references("RootPOA"); if (CORBA::is_nil (poa_object.in ())) - { - ACE_ERROR_RETURN ((LM_ERROR, - " (%P|%t) Unable to initialize the POA.\n"), - 1); - } + ACE_ERROR_RETURN ((LM_ERROR, + " (%P|%t) Unable to initialize the POA.\n"), + 1); - PortableServer::POA_var root_poa = PortableServer::POA::_narrow (poa_object.in (), TAO_TRY_ENV); + PortableServer::POA_var root_poa = + PortableServer::POA::_narrow (poa_object.in (), TAO_TRY_ENV); TAO_CHECK_ENV; - PortableServer::POAManager_var poa_manager = root_poa->the_POAManager (TAO_TRY_ENV); + PortableServer::POAManager_var poa_manager = + root_poa->the_POAManager (TAO_TRY_ENV); TAO_CHECK_ENV; - // Get the Naming Service object reference - CORBA::Object_var naming_obj = orb->resolve_initial_references ("NameService"); + // Get the Naming Service object reference. + CORBA::Object_var naming_obj = + orb->resolve_initial_references ("NameService"); + if (CORBA::is_nil (naming_obj.in ())) - { - ACE_ERROR_RETURN ((LM_ERROR, - " (%P|%t) Unable get the Naming Service.\n"), - 1); - } + ACE_ERROR_RETURN ((LM_ERROR, + " (%P|%t) Unable get the Naming Service.\n"), + 1); CosNaming::NamingContext_var naming_context = - CosNaming::NamingContext::_narrow (naming_obj.in (), TAO_TRY_ENV); + CosNaming::NamingContext::_narrow (naming_obj.in (), + TAO_TRY_ENV); TAO_CHECK_ENV; - - // Tell the ScheduleService to use the same naming service + // Tell the ScheduleService to use the same naming service. ACE_Scheduler_Factory::use_config (naming_context.in ()); if (get_options (argc, argv)) @@ -682,37 +671,46 @@ main (int argc, char *argv []) channel_name.length (1); channel_name[0].id = CORBA::string_dup ("EventService"); - CORBA::Object_var ec_obj = naming_context->resolve (channel_name, TAO_TRY_ENV); + CORBA::Object_var ec_obj = + naming_context->resolve (channel_name, TAO_TRY_ENV); TAO_CHECK_ENV; RtecEventChannelAdmin::EventChannel_var ec = - RtecEventChannelAdmin::EventChannel::_narrow (ec_obj.in(), TAO_TRY_ENV); + RtecEventChannelAdmin::EventChannel::_narrow (ec_obj.in(), + TAO_TRY_ENV); TAO_CHECK_ENV; - // Create the demo supplier + // Create the demo supplier. Demo_Supplier *demo_supplier; - ACE_NEW_RETURN (demo_supplier, Demo_Supplier (SOURCE_ID), -1); + ACE_NEW_RETURN (demo_supplier, + Demo_Supplier (SOURCE_ID), + -1); - if (demo_supplier->open_supplier (ec.ptr (), "demo_supplier") == -1) - ACE_ERROR_RETURN ((LM_ERROR, "Supplier open failed.\n"), -1); + if (demo_supplier->open_supplier (ec.ptr (), + "demo_supplier") == -1) + ACE_ERROR_RETURN ((LM_ERROR, + "Supplier open failed.\n"), + -1); - - // Register the internal demo consumer for timeout events + // Register the internal demo consumer for timeout events. demo_supplier->start_generating_events (); - ACE_DEBUG ((LM_DEBUG, "Supplier is registered for timeout events.\n")); + ACE_DEBUG ((LM_DEBUG, + "Supplier is registered for timeout events.\n")); - // The POA Manager has to be activated before starting the ORB event loop + // The POA Manager has to be activated before starting the ORB + // event loop. poa_manager->activate (TAO_TRY_ENV); TAO_CHECK_ENV; - // Run the ORB - + // Run the ORB. if (orb->run () == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "CORBA::ORB::run"), -1); + ACE_ERROR_RETURN ((LM_ERROR, + "%p\n", + "CORBA::ORB::run"), + -1); TAO_CHECK_ENV; - delete demo_supplier; TAO_CHECK_ENV; @@ -723,6 +721,5 @@ main (int argc, char *argv []) } TAO_ENDTRY; - return 0; } diff --git a/TAO/examples/Simulator/Event_Supplier/Event_Sup.h b/TAO/examples/Simulator/Event_Supplier/Event_Sup.h index 747a49f3a93..2b45455e181 100644 --- a/TAO/examples/Simulator/Event_Supplier/Event_Sup.h +++ b/TAO/examples/Simulator/Event_Supplier/Event_Sup.h @@ -1,11 +1,13 @@ // $Id$ -// + // ============================================================================ -// // // = FILENAME // Event_Sup.h // +// = DESCRIPTION +// Event Supplier for the simulation +// // = AUTHOR // originally // David Levine (levine@cs.wustl.edu) and @@ -13,9 +15,6 @@ // modified // Michael Kircher (mk1@cs.wustl.edu) // -// = DESCRIPTION -// Event Supplier for the simulation -// // ============================================================================ #if !defined (EVENT_SUP_H) @@ -41,16 +40,15 @@ struct Schedule_Viewer_Data }; class Demo_Supplier -// = TITLE -// Demo Supplier -// -// = DESCRIPTION -// Generates event nofications and a shutdown message. { + // = TITLE + // Demo Supplier. + // + // = DESCRIPTION + // Generates event nofications and a shutdown message. public: - - - class Internal_Demo_Consumer : public POA_RtecEventComm::PushConsumer { + class Internal_Demo_Consumer : public POA_RtecEventComm::PushConsumer + { public: virtual void push (const RtecEventComm::EventSet &events, CORBA::Environment &); @@ -66,13 +64,13 @@ public: private: Demo_Supplier* impl_; }; - // The following Supplier is needed because Demo_Supplier has not - // inherited from PushSupplier, therefore we register with the - // following and send with Demo_Supplier + // inherited from PushSupplier, therefore we register with the + // following and send with Demo_Supplier. - class Internal_Demo_Supplier : public POA_RtecEventComm::PushSupplier { + class Internal_Demo_Supplier : public POA_RtecEventComm::PushSupplier + { public: virtual void disconnect_push_supplier (CORBA::Environment &); @@ -84,8 +82,7 @@ public: Demo_Supplier* impl_; }; - - Demo_Supplier (unsigned int supplier_id); + Demo_Supplier (u_int supplier_id); // Construction. Requires the total number of messages to be // sent. If the timestamp flag is enabled, then events are // timestamped, e.g., for use in measuring jitter. @@ -103,16 +100,13 @@ public: void start_generating_events (void); - void load_schedule_data ( - ACE_Unbounded_Queue<Schedule_Viewer_Data *> &schedule_data); + void load_schedule_data (ACE_Unbounded_Queue<Schedule_Viewer_Data *> &schedule_data); - void insert_event_data ( - CORBA::Any &data, - ACE_Unbounded_Queue_Iterator<Schedule_Viewer_Data *> &schedule_iter); + void insert_event_data (CORBA::Any &data, + ACE_Unbounded_Queue_Iterator<Schedule_Viewer_Data *> &schedule_iter); void push (const RtecEventComm::EventSet &events, CORBA::Environment &); - protected: void shutdown (void); @@ -123,7 +117,7 @@ protected: RtecEventChannelAdmin::SupplierAdmin_var supplier_admin_; RtecEventChannelAdmin::ProxyPushConsumer_var proxy_consumer_; - // Because we get timeout events in our internal_demo_consumer + // = Because we get timeout events in our internal_demo_consumer. RtecEventChannelAdmin::ConsumerAdmin_var consumer_admin_; RtecEventChannelAdmin::ProxyPushSupplier_var proxy_supplier_; @@ -131,11 +125,10 @@ private: Navigation navigation_; Weapons weapons_; RtecScheduler::handle_t rt_info_; - unsigned int supplier_id_; + u_int supplier_id_; Internal_Demo_Consumer *internal_demo_consumer_; Internal_Demo_Supplier *internal_demo_supplier_; }; - #endif /* EVENT_SUP_H */ diff --git a/TAO/examples/Simulator/NavWeap.idl b/TAO/examples/Simulator/NavWeap.idl index 2427d5aaccc..f3bc10f9412 100644 --- a/TAO/examples/Simulator/NavWeap.idl +++ b/TAO/examples/Simulator/NavWeap.idl @@ -1,50 +1,53 @@ -// // $Id$ -// - -// = TITLE -// Navigation and Weapon structs for the Boing DOVE/EventService demo +// ========================================================================================================= +// +// = FILE +// NavWeap.idl // // = DESCRIPTION +// Navigation and Weapon structs for the DOVE/EventService demo. - -struct Navigation { - long position_latitude; - long position_longitude; - unsigned long altitude; - long heading; - long roll; - long pitch; - // common part - double utilitzation; - double overhead; - unsigned long arrival_time; - unsigned long deadline_time; - unsigned long completion_time; - unsigned long computation_time; +// = AUTHOR +// Michael Kircher <mk1@cec.wustl.edu> +// +// ========================================================================================================= + +struct Navigation +{ + long position_latitude; + long position_longitude; + unsigned long altitude; + long heading; + long roll; + long pitch; + // common part + double utilitzation; + double overhead; + unsigned long arrival_time; + unsigned long deadline_time; + unsigned long completion_time; + unsigned long computation_time; }; - -struct Weapons { - unsigned long number_of_weapons; - string weapon1_identifier; - unsigned long weapon1_status; - string weapon2_identifier; - unsigned long weapon2_status; - string weapon3_identifier; - unsigned long weapon3_status; - string weapon4_identifier; - unsigned long weapon4_status; - string weapon5_identifier; - unsigned long weapon5_status; - // common part - double utilitzation; - double overhead; - unsigned long arrival_time; - unsigned long deadline_time; - unsigned long completion_time; - unsigned long computation_time; +struct Weapons +{ + unsigned long number_of_weapons; + string weapon1_identifier; + unsigned long weapon1_status; + string weapon2_identifier; + unsigned long weapon2_status; + string weapon3_identifier; + unsigned long weapon3_status; + string weapon4_identifier; + unsigned long weapon4_status; + string weapon5_identifier; + unsigned long weapon5_status; + // common part + double utilitzation; + double overhead; + unsigned long arrival_time; + unsigned long deadline_time; + unsigned long completion_time; + unsigned long computation_time; }; - - @@ -1,4 +1,4 @@ -This is ACE version 4.4.34, released Fri Mar 20 19:47:34 1998. +This is ACE version 4.4.33, released Fri Mar 20 19:47:34 1998. If you have any problems with ACE, please send email to Douglas C. Schmidt (schmidt@cs.wustl.edu). |