diff options
author | elliott_c <elliott_c@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2007-01-25 18:17:52 +0000 |
---|---|---|
committer | elliott_c <elliott_c@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2007-01-25 18:17:52 +0000 |
commit | 2ee7b7eed4c0cc10f4ec25b186b04202af01b565 (patch) | |
tree | 08a8a649c90559cf5b2228c1caad15515902613e /TAO/tests/File_IO | |
parent | c979767a00db4ea1299af482033a68829cc16675 (diff) | |
download | ATCD-2ee7b7eed4c0cc10f4ec25b186b04202af01b565.tar.gz |
ChangeLogTag: Thu Jan 25 17:39:59 UTC 2007 Chad Elliott <elliott_c@ociweb.com>
Diffstat (limited to 'TAO/tests/File_IO')
-rw-r--r-- | TAO/tests/File_IO/File_i.cpp | 32 | ||||
-rw-r--r-- | TAO/tests/File_IO/File_i.h | 12 | ||||
-rw-r--r-- | TAO/tests/File_IO/client.cpp | 47 | ||||
-rw-r--r-- | TAO/tests/File_IO/server.cpp | 49 |
4 files changed, 55 insertions, 85 deletions
diff --git a/TAO/tests/File_IO/File_i.cpp b/TAO/tests/File_IO/File_i.cpp index 82968309692..3622604315c 100644 --- a/TAO/tests/File_IO/File_i.cpp +++ b/TAO/tests/File_IO/File_i.cpp @@ -27,9 +27,8 @@ FileImpl::System::System (PortableServer::POA_ptr poa) // Create the Default Descriptor Servant fd_servant_ (poa) { - ACE_DECLARE_NEW_CORBA_ENV; // set the default servant of the POA - poa->set_servant (&this->fd_servant_ ACE_ENV_ARG_PARAMETER); + poa->set_servant (&this->fd_servant_); } FileImpl::System::~System (void) @@ -44,8 +43,7 @@ FileImpl::System::_default_POA (void) File::Descriptor_ptr FileImpl::System::open (const char *file_name, - CORBA::Long flags - ACE_ENV_ARG_DECL) + CORBA::Long flags) ACE_THROW_SPEC ((CORBA::SystemException, File::IOError)) { @@ -74,12 +72,11 @@ FileImpl::System::open (const char *file_name, // from ACE_HANDLE string CORBA::Object_var obj = this->poa_->create_reference_with_id (oid.in (), - "IDL:File/Descriptor:1.0" - ACE_ENV_ARG_PARAMETER); + "IDL:File/Descriptor:1.0"); // Narrow the object reference to a File Descriptor File::Descriptor_var fd = - File::Descriptor::_narrow (obj.in () ACE_ENV_ARG_PARAMETER); + File::Descriptor::_narrow (obj.in ()); return fd._retn (); @@ -114,31 +111,29 @@ FileImpl::Descriptor::fd (void) // Get the ObjectId from the reference PortableServer::ObjectId_var oid1 = - this->poa_->reference_to_id (me.in () ACE_ENV_ARG_PARAMETER); + this->poa_->reference_to_id (me.in ()); // // Another way of getting our id. // PortableServer::ObjectId_var oid2 = - this->poa_->servant_to_id (this ACE_ENV_ARG_PARAMETER); + this->poa_->servant_to_id (this); // // Yet another way of getting our id. // int argc = 0; - CORBA::ORB_var orb = CORBA::ORB_init (argc, 0, 0 ACE_ENV_ARG_PARAMETER); + CORBA::ORB_var orb = CORBA::ORB_init (argc, 0, 0); // Get the POA Current object reference CORBA::Object_var obj = - orb->resolve_initial_references ("POACurrent" - ACE_ENV_ARG_PARAMETER); + orb->resolve_initial_references ("POACurrent"); // Narrow the object reference to a POA Current reference PortableServer::Current_var poa_current = - PortableServer::Current::_narrow (obj.in () - ACE_ENV_ARG_PARAMETER); + PortableServer::Current::_narrow (obj.in ()); PortableServer::ObjectId_var oid3 = poa_current->get_object_id (); @@ -155,8 +150,7 @@ FileImpl::Descriptor::fd (void) } CORBA::Long -FileImpl::Descriptor::write (const File::Descriptor::DataBuffer &buffer - ACE_ENV_ARG_DECL) +FileImpl::Descriptor::write (const File::Descriptor::DataBuffer &buffer) ACE_THROW_SPEC ((CORBA::SystemException, File::IOError)) { @@ -174,8 +168,7 @@ FileImpl::Descriptor::write (const File::Descriptor::DataBuffer &buffer } File::Descriptor::DataBuffer * -FileImpl::Descriptor::read (CORBA::Long num_bytes - ACE_ENV_ARG_DECL) +FileImpl::Descriptor::read (CORBA::Long num_bytes) ACE_THROW_SPEC ((CORBA::SystemException, File::IOError)) { @@ -196,8 +189,7 @@ FileImpl::Descriptor::read (CORBA::Long num_bytes CORBA::ULong FileImpl::Descriptor::lseek (CORBA::ULong offset, - CORBA::Long whence - ACE_ENV_ARG_DECL) + CORBA::Long whence) ACE_THROW_SPEC ((CORBA::SystemException, File::IOError)) { diff --git a/TAO/tests/File_IO/File_i.h b/TAO/tests/File_IO/File_i.h index c77d5cdd66f..1a6ba088622 100644 --- a/TAO/tests/File_IO/File_i.h +++ b/TAO/tests/File_IO/File_i.h @@ -37,21 +37,18 @@ public: PortableServer::POA_ptr _default_POA (void); // Returns the default POA of this object - virtual CORBA::Long write (const File::Descriptor::DataBuffer &buffer - ACE_ENV_ARG_DECL) + virtual CORBA::Long write (const File::Descriptor::DataBuffer &buffer) ACE_THROW_SPEC ((CORBA::SystemException, File::IOError)); // write buffer to File corresponding to this Descriptor - virtual File::Descriptor::DataBuffer *read (CORBA::Long num_bytes - ACE_ENV_ARG_DECL) + virtual File::Descriptor::DataBuffer *read (CORBA::Long num_bytes) ACE_THROW_SPEC ((CORBA::SystemException, // Reads num_bytes from the file and returns it File::IOError)); virtual CORBA::ULong lseek (CORBA::ULong offset, - CORBA::Long whence - ACE_ENV_ARG_DECL) + CORBA::Long whence) ACE_THROW_SPEC ((CORBA::SystemException, File::IOError)); // seek to the offset in file from whence @@ -84,8 +81,7 @@ public: //Returns the default POA of this object File::Descriptor_ptr open (const char *file_name, - CORBA::Long flags - ACE_ENV_ARG_DECL) + CORBA::Long flags) ACE_THROW_SPEC ((CORBA::SystemException, File::IOError)); // Opens a file ,creates a Descriptor reference with the diff --git a/TAO/tests/File_IO/client.cpp b/TAO/tests/File_IO/client.cpp index e27d088db8c..037b77a8fb1 100644 --- a/TAO/tests/File_IO/client.cpp +++ b/TAO/tests/File_IO/client.cpp @@ -80,53 +80,46 @@ parse_args (int argc, char **argv) } void -validate_connection (CORBA::Object_ptr object - ACE_ENV_ARG_DECL) +validate_connection (CORBA::Object_ptr object) { // Try to validate the connection several times, ignoring transient // exceptions. If the connection can still not be setup, return // failure. for (int i = 0; i < 100; ++i) { - ACE_TRY + try { object->_non_existent (); } - ACE_CATCH (CORBA::TRANSIENT, exception) + catch (const CORBA::TRANSIENT& ) { // Ignore... } - ACE_CATCHANY + catch (const CORBA::Exception& ex) { // Rethrow any other exceptions. - ACE_RE_THROW; + throw; } - ACE_ENDTRY; } } static void * MTTEST (void *args) { - ACE_DECLARE_NEW_CORBA_ENV; ACE_CString &ior = *(ACE_CString*)args; - ACE_TRY + try { - CORBA::Object_var object = orb->string_to_object (ior.c_str () - ACE_ENV_ARG_PARAMETER); + CORBA::Object_var object = orb->string_to_object (ior.c_str ()); - validate_connection (object.in () - ACE_ENV_ARG_PARAMETER); + validate_connection (object.in ()); // Narrow the object reference to a File::System - File::System_var file_system = File::System::_narrow (object.in () - ACE_ENV_ARG_PARAMETER); + File::System_var file_system = File::System::_narrow (object.in ()); // Creat the file filename i.e "test" File::Descriptor_var fd = file_system->open (filename, - O_RDONLY - ACE_ENV_ARG_PARAMETER); + O_RDONLY); for( int i = 0; i < iterations; ++i) { @@ -135,23 +128,21 @@ MTTEST (void *args) ACE_DEBUG((LM_DEBUG,"Making request number %d\n",i)); #endif /*if 0*/ - fd->lseek (0, SEEK_SET ACE_ENV_ARG_PARAMETER); + fd->lseek (0, SEEK_SET); // Read back the written message // Twice the size of the socket buffer - File::Descriptor::DataBuffer_var data_received = fd->read (128*1024 - ACE_ENV_ARG_PARAMETER); + File::Descriptor::DataBuffer_var data_received = fd->read (128*1024); } // close the file fd->destroy (); } - ACE_CATCHANY + catch (const CORBA::Exception& ex) { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Exception caught in main"); + ex._tao_print_exception ("Exception caught in main"); return 0; } - ACE_ENDTRY; return 0; } @@ -159,12 +150,11 @@ MTTEST (void *args) int main (int argc, char **argv) { - ACE_DECLARE_NEW_CORBA_ENV; - ACE_TRY + try { // Initialize the ORB - orb = CORBA::ORB_init (argc, argv, 0 ACE_ENV_ARG_PARAMETER); + orb = CORBA::ORB_init (argc, argv, 0); // Parse the command-line arguments to get the IOR parse_args (argc, argv); @@ -202,12 +192,11 @@ main (int argc, char **argv) } ACE_Thread_Manager::instance()->wait(); } - ACE_CATCHANY + catch (const CORBA::Exception& ex) { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Exception caught in main"); + ex._tao_print_exception ("Exception caught in main"); return -1; } - ACE_ENDTRY; return 0; } diff --git a/TAO/tests/File_IO/server.cpp b/TAO/tests/File_IO/server.cpp index e3f281db114..6099a4ca342 100644 --- a/TAO/tests/File_IO/server.cpp +++ b/TAO/tests/File_IO/server.cpp @@ -79,11 +79,10 @@ main (int argc, char *argv[]) ACE_OS::write (handle, "", 1); ACE_OS::close (handle); - ACE_DECLARE_NEW_CORBA_ENV; - ACE_TRY + try { // Initialize the ORB - CORBA::ORB_var orb = CORBA::ORB_init (argc, argv, 0 ACE_ENV_ARG_PARAMETER); + CORBA::ORB_var orb = CORBA::ORB_init (argc, argv, 0); int result = parse_args (argc, argv); if (result != 0) @@ -91,12 +90,11 @@ main (int argc, char *argv[]) // Obtain the RootPOA. CORBA::Object_var obj = - orb->resolve_initial_references ("RootPOA" - ACE_ENV_ARG_PARAMETER); + orb->resolve_initial_references ("RootPOA"); // Narrow the object reference to a POA reference PortableServer::POA_var root_poa = - PortableServer::POA::_narrow (obj.in () ACE_ENV_ARG_PARAMETER); + PortableServer::POA::_narrow (obj.in ()); PortableServer::POAManager_var poa_manager = root_poa->the_POAManager (); @@ -106,30 +104,29 @@ main (int argc, char *argv[]) // ID Assignment Policy policies[0] = - root_poa->create_id_assignment_policy (PortableServer::USER_ID ACE_ENV_ARG_PARAMETER); + root_poa->create_id_assignment_policy (PortableServer::USER_ID); // Lifespan Policy policies[1] = - root_poa->create_lifespan_policy (PortableServer::PERSISTENT ACE_ENV_ARG_PARAMETER); + root_poa->create_lifespan_policy (PortableServer::PERSISTENT); // Request Processing Policy policies[2] = - root_poa->create_request_processing_policy (PortableServer::USE_DEFAULT_SERVANT ACE_ENV_ARG_PARAMETER); + root_poa->create_request_processing_policy (PortableServer::USE_DEFAULT_SERVANT); // Servant Retention Policy policies[3] = - root_poa->create_servant_retention_policy (PortableServer::RETAIN ACE_ENV_ARG_PARAMETER); + root_poa->create_servant_retention_policy (PortableServer::RETAIN); // Id Uniqueness Policy policies[4] = - root_poa->create_id_uniqueness_policy (PortableServer::MULTIPLE_ID ACE_ENV_ARG_PARAMETER); + root_poa->create_id_uniqueness_policy (PortableServer::MULTIPLE_ID); ACE_CString name = "firstPOA"; PortableServer::POA_var first_poa = root_poa->create_POA (name.c_str (), poa_manager.in (), - policies - ACE_ENV_ARG_PARAMETER); + policies); for (CORBA::ULong i = 0; i < policies.length (); @@ -146,15 +143,14 @@ main (int argc, char *argv[]) PortableServer::string_to_ObjectId ("FileSystem"); first_poa->activate_object_with_id (file_system_oid.in (), - &file_system_impl - ACE_ENV_ARG_PARAMETER); + &file_system_impl); CORBA::Object_var file_system = - first_poa->id_to_reference (file_system_oid.in () ACE_ENV_ARG_PARAMETER); + first_poa->id_to_reference (file_system_oid.in ()); // Get the IOR for the "FileSystem" object CORBA::String_var file_system_ior = - orb->object_to_string (file_system.in () ACE_ENV_ARG_PARAMETER); + orb->object_to_string (file_system.in ()); ACE_DEBUG ((LM_DEBUG,"%s\n", file_system_ior.in ())); @@ -181,18 +177,17 @@ main (int argc, char *argv[]) worker.thr_mgr ()->wait (); - first_poa->destroy(1, 1 ACE_ENV_ARG_PARAMETER); + first_poa->destroy(1, 1); - root_poa->destroy(1, 1 ACE_ENV_ARG_PARAMETER); + root_poa->destroy(1, 1); orb->destroy(); } - ACE_CATCHANY + catch (const CORBA::Exception& ex) { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "EXCEPTION CAUGHT"); + ex._tao_print_exception ("EXCEPTION CAUGHT"); return -1; } - ACE_ENDTRY; return 0; } @@ -208,19 +203,17 @@ Worker::Worker (CORBA::ORB_ptr orb) int Worker::svc (void) { - ACE_DECLARE_NEW_CORBA_ENV; - ACE_TRY + try { // Run the ORB for atmost 75 seconds ACE_Time_Value tv (75, 0); - this->orb_->run (tv ACE_ENV_ARG_PARAMETER); + this->orb_->run (tv); } - ACE_CATCHANY + catch (const CORBA::Exception& ex) { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Worker::svc"); + ex._tao_print_exception ("Worker::svc"); return -1; } - ACE_ENDTRY; return 0; } |