diff options
author | Ossama Othman <ossama-othman@users.noreply.github.com> | 2001-12-08 21:59:30 +0000 |
---|---|---|
committer | Ossama Othman <ossama-othman@users.noreply.github.com> | 2001-12-08 21:59:30 +0000 |
commit | b11770b30f8b58d20fe2d61846bfa3fc5354ee7e (patch) | |
tree | 6939cf1ed0a80ce8a3224d33f3d23c0e1b9a517f /TAO/orbsvcs/tests/AVStreams/Pluggable/ftp.cpp | |
parent | 8fd5b8293423d91c699711bce0f3551cb8c20a69 (diff) | |
download | ATCD-b11770b30f8b58d20fe2d61846bfa3fc5354ee7e.tar.gz |
Merged corba-env-clean branch.
Diffstat (limited to 'TAO/orbsvcs/tests/AVStreams/Pluggable/ftp.cpp')
-rw-r--r-- | TAO/orbsvcs/tests/AVStreams/Pluggable/ftp.cpp | 190 |
1 files changed, 95 insertions, 95 deletions
diff --git a/TAO/orbsvcs/tests/AVStreams/Pluggable/ftp.cpp b/TAO/orbsvcs/tests/AVStreams/Pluggable/ftp.cpp index 354ea8d2b3a..969f9c8d451 100644 --- a/TAO/orbsvcs/tests/AVStreams/Pluggable/ftp.cpp +++ b/TAO/orbsvcs/tests/AVStreams/Pluggable/ftp.cpp @@ -79,9 +79,9 @@ Client::parse_args (int argc, case 'p': this->protocol_ = ACE_OS::strdup (opts.optarg); break; - case 'r': - this->frame_rate_ = ACE_OS::atoi (opts.optarg); - break; + case 'r': + this->frame_rate_ = ACE_OS::atoi (opts.optarg); + break; case 's': this->use_sfp_ = 1; break; @@ -124,14 +124,14 @@ Client::frame_rate (void) // Method to get the object reference of the server int -Client::bind_to_server (CORBA::Environment &ACE_TRY_ENV) +Client::bind_to_server (TAO_ENV_SINGLE_ARG_DECL) { // Initialize the naming services if (my_naming_client_.init (TAO_AV_CORE::instance ()->orb ()) != 0) ACE_ERROR_RETURN ((LM_ERROR, - " (%P|%t) Unable to initialize " - "the TAO_Naming_Client. \n"), - -1); + " (%P|%t) Unable to initialize " + "the TAO_Naming_Client. \n"), + -1); CosNaming::Name server_mmdevice_name (1); server_mmdevice_name.length (1); @@ -139,27 +139,27 @@ Client::bind_to_server (CORBA::Environment &ACE_TRY_ENV) // Resolve the server object reference from the Naming Service CORBA::Object_var server_mmdevice_obj = - my_naming_client_->resolve (server_mmdevice_name, - ACE_TRY_ENV); + my_naming_client_->resolve (server_mmdevice_name + TAO_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (-1); this->server_mmdevice_ = - AVStreams::MMDevice::_narrow (server_mmdevice_obj.in (), - ACE_TRY_ENV); + AVStreams::MMDevice::_narrow (server_mmdevice_obj.in () + TAO_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (-1); if (CORBA::is_nil (this->server_mmdevice_.in ())) ACE_ERROR_RETURN ((LM_ERROR, - "Could not resolve Server_MMdevice in Naming service <%s>\n"), - -1); + "Could not resolve Server_MMdevice in Naming service <%s>\n"), + -1); return 0; } int Client::init (int argc, - char **argv, - CORBA::Environment& ACE_TRY_ENV) + char **argv + TAO_ENV_ARG_DECL) { this->argc_ = argc; this->argv_ = argv; @@ -179,15 +179,15 @@ Client::init (int argc, // Open file to read. this->fp_ = ACE_OS::fopen (this->filename_, - "r"); + "r"); if (this->fp_ == 0) ACE_ERROR_RETURN ((LM_DEBUG, - "Cannot open output file %s\n", - this->filename_), - -1); + "Cannot open output file %s\n", + this->filename_), + -1); - result - = this->bind_to_server (ACE_TRY_ENV); + result + = this->bind_to_server (TAO_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK_RETURN (-1); // Resolve the object reference of the server from the Naming Service. @@ -195,15 +195,15 @@ Client::init (int argc, ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) Error binding to the naming service\n"), -1); - + // Create the Flow protocol name char flow_protocol_str [BUFSIZ]; if (this->use_sfp_) ACE_OS::strcpy (flow_protocol_str, - "sfp:1.0"); + "sfp:1.0"); else ACE_OS::strcpy (flow_protocol_str, - ""); + ""); // Initialize the QoS AVStreams::streamQoS_var the_qos (new AVStreams::streamQoS); @@ -213,36 +213,36 @@ Client::init (int argc, // Initialize the flowname ACE_NEW_RETURN (this->flowname_, - char [BUFSIZ], - 0); + char [BUFSIZ], + 0); ACE_OS::sprintf (this->flowname_, - "Data_%s", - this->protocol_); + "Data_%s", + this->protocol_); // Create the forward flow specification to describe the flow. TAO_Forward_FlowSpec_Entry entry (this->flowname_, - "IN", - "USER_DEFINED", - flow_protocol_str, - this->protocol_, - &addr); + "IN", + "USER_DEFINED", + flow_protocol_str, + this->protocol_, + &addr); AVStreams::flowSpec flow_spec (1); flow_spec [0] = CORBA::string_dup (entry.entry_to_string ()); flow_spec.length (1); - AVStreams::MMDevice_var client_mmdevice = - this->client_mmdevice_._this (ACE_TRY_ENV); + AVStreams::MMDevice_var client_mmdevice = + this->client_mmdevice_._this (TAO_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK_RETURN (-1); // Bind/Connect the client and server MMDevices. CORBA::Boolean bind_result = this->streamctrl_.bind_devs (client_mmdevice.in (), - this->server_mmdevice_.in (), - the_qos.inout (), - flow_spec, - ACE_TRY_ENV); + this->server_mmdevice_.in (), + the_qos.inout (), + flow_spec + TAO_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (-1); if (bind_result == 0) @@ -253,7 +253,7 @@ Client::init (int argc, // Method to send data at the specified rate int -Client::pace_data (CORBA::Environment& ACE_TRY_ENV) +Client::pace_data (TAO_ENV_SINGLE_ARG_DECL) { // Rate at which frames of data need to be sent. @@ -281,45 +281,45 @@ Client::pace_data (CORBA::Environment& ACE_TRY_ENV) // Continue to send data till the file is read to the end. while (1) - { + { // Count the frames sent. - count_++; + count_++; // Read from the file into a message block. - int n = ACE_OS::fread(this->mb.rd_ptr (), - 1, - this->mb.size (), - CLIENT::instance ()->file ()); - - if (n < 0) - ACE_ERROR_RETURN ((LM_ERROR, - "FTP_Client_Flow_Handler::fread end of file\n"), - -1); - - if (n == 0) - { - if (feof (CLIENT::instance ()->file ())) - { + int n = ACE_OS::fread(this->mb.rd_ptr (), + 1, + this->mb.size (), + CLIENT::instance ()->file ()); + + if (n < 0) + ACE_ERROR_RETURN ((LM_ERROR, + "FTP_Client_Flow_Handler::fread end of file\n"), + -1); + + if (n == 0) + { + if (feof (CLIENT::instance ()->file ())) + { // At end of file break the loop and end the client. if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG,"Handle_Start:End of file\n")); break; } - } + } - this->mb.wr_ptr (n); + this->mb.wr_ptr (n); - if ( this->count_ > 1) - { + if ( this->count_ > 1) + { // Greater than the first frame. // Stop the timer that was started just before the previous frame was sent. - last_frame_sent_time.stop (); + last_frame_sent_time.stop (); // Get the time elapsed after sending the previous frame. - ACE_Time_Value tv; - last_frame_sent_time.elapsed_time (tv); + ACE_Time_Value tv; + last_frame_sent_time.elapsed_time (tv); if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, @@ -327,12 +327,12 @@ Client::pace_data (CORBA::Environment& ACE_TRY_ENV) tv.msec ())); // Check to see if the inter frame time has elapsed. - if (tv < inter_frame_time) - { + if (tv < inter_frame_time) + { // Inter frame time has not elapsed. // Claculate the time to wait before the next frame needs to be sent. - ACE_Time_Value wait_time (inter_frame_time - tv); + ACE_Time_Value wait_time (inter_frame_time - tv); if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, @@ -340,32 +340,32 @@ Client::pace_data (CORBA::Environment& ACE_TRY_ENV) wait_time.msec ())); // run the orb for the wait time so the client can continue other orb requests. - TAO_AV_CORE::instance ()->orb ()->run (wait_time, - ACE_TRY_ENV); + TAO_AV_CORE::instance ()->orb ()->run (wait_time + TAO_ENV_ARG_PARAMETER); ACE_TRY_CHECK; - } - } + } + } // Start timer before sending the frame. - last_frame_sent_time.start (); + last_frame_sent_time.start (); // Send frame. int result = this->protocol_object_->send_frame (&this->mb); - if (result < 0) - ACE_ERROR_RETURN ((LM_ERROR, - "send failed:%p","FTP_Client_Flow_Handler::send\n"), - -1); + if (result < 0) + ACE_ERROR_RETURN ((LM_ERROR, + "send failed:%p","FTP_Client_Flow_Handler::send\n"), + -1); ACE_DEBUG ((LM_DEBUG,"Client::pace_data buffer sent succesfully\n")); // Reset the mb. this->mb.reset (); - } // end while + } // end while // Since the file is read stop the stream. AVStreams::flowSpec stop_spec (1); - CLIENT::instance ()->streamctrl ()->destroy (stop_spec, - ACE_TRY_ENV); + CLIENT::instance ()->streamctrl ()->destroy (stop_spec + TAO_ENV_ARG_PARAMETER); ACE_TRY_CHECK; // Shut the orb down. @@ -376,7 +376,7 @@ Client::pace_data (CORBA::Environment& ACE_TRY_ENV) ACE_CATCHANY { ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, - "Client::pace_data Failed"); + "Client::pace_data Failed"); return -1; } ACE_ENDTRY; @@ -387,52 +387,52 @@ int main (int argc, char **argv) { - ACE_DECLARE_NEW_CORBA_ENV; + TAO_ENV_DECLARE_NEW_ENV; ACE_TRY { CORBA::ORB_var orb = CORBA::ORB_init (argc, argv, - 0, - ACE_TRY_ENV); + 0 + TAO_ENV_ARG_PARAMETER); CORBA::Object_var obj - = orb->resolve_initial_references ("RootPOA", - ACE_TRY_ENV); + = orb->resolve_initial_references ("RootPOA" + TAO_ENV_ARG_PARAMETER); ACE_TRY_CHECK; //Get the POA_var object from Object_var PortableServer::POA_var root_poa - = PortableServer::POA::_narrow (obj.in (), - ACE_TRY_ENV); + = PortableServer::POA::_narrow (obj.in () + TAO_ENV_ARG_PARAMETER); ACE_TRY_CHECK; PortableServer::POAManager_var mgr - = root_poa->the_POAManager (ACE_TRY_ENV); + = root_poa->the_POAManager (TAO_ENV_SINGLE_ARG_PARAMETER); ACE_TRY_CHECK; - mgr->activate (ACE_TRY_ENV); + mgr->activate (TAO_ENV_SINGLE_ARG_PARAMETER); ACE_TRY_CHECK; // Initialize the AV STream components. TAO_AV_CORE::instance ()->init (orb.in (), - root_poa.in (), - ACE_TRY_ENV); + root_poa.in () + TAO_ENV_ARG_PARAMETER); ACE_TRY_CHECK; // INitialize the Client. int result = 0; result = CLIENT::instance ()->init (argc, - argv, - ACE_TRY_ENV); + argv + TAO_ENV_ARG_PARAMETER); if (result < 0) ACE_ERROR_RETURN ((LM_ERROR, - "client::init failed\n"),1); + "client::init failed\n"),1); // Start sending data. - result = CLIENT::instance ()->pace_data (ACE_TRY_ENV); + result = CLIENT::instance ()->pace_data (TAO_ENV_SINGLE_ARG_PARAMETER); ACE_TRY_CHECK; - orb->destroy (ACE_TRY_ENV); + orb->destroy (TAO_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK_RETURN (-1); } ACE_CATCHANY |