diff options
author | William R. Otte <wotte@dre.vanderbilt.edu> | 2006-07-24 15:50:11 +0000 |
---|---|---|
committer | William R. Otte <wotte@dre.vanderbilt.edu> | 2006-07-24 15:50:11 +0000 |
commit | 6b846cf03c0bcbd8c276cb0af61a181e5f98eaae (patch) | |
tree | da50d054f9c761c3f6a5923f6979e93306c56d68 /TAO/orbsvcs/tests/ImplRepo/nestea_client_i.cpp | |
parent | 0e555b9150d38e3b3473ba325b56db2642e6352b (diff) | |
download | ATCD-6b846cf03c0bcbd8c276cb0af61a181e5f98eaae.tar.gz |
Repo restructuring
Diffstat (limited to 'TAO/orbsvcs/tests/ImplRepo/nestea_client_i.cpp')
-rw-r--r-- | TAO/orbsvcs/tests/ImplRepo/nestea_client_i.cpp | 138 |
1 files changed, 0 insertions, 138 deletions
diff --git a/TAO/orbsvcs/tests/ImplRepo/nestea_client_i.cpp b/TAO/orbsvcs/tests/ImplRepo/nestea_client_i.cpp deleted file mode 100644 index a92bf39e6c8..00000000000 --- a/TAO/orbsvcs/tests/ImplRepo/nestea_client_i.cpp +++ /dev/null @@ -1,138 +0,0 @@ -// $Id$ - -#include "nestea_client_i.h" -#include "tao/debug.h" -#include "ace/Get_Opt.h" -#include "ace/Read_Buffer.h" -#include "ace/ACE.h" - -ACE_RCSID(ImplRepo, nestea_client_i, "$Id$") - -// Constructor. -Nestea_Client_i::Nestea_Client_i (void) - : server_key_ (ACE::strnew ("key0")) - , server_ (Nestea_Bookshelf::_nil ()) - , shutdown_server_(false) -{ -} - - -// Parses the command line arguments and returns an error status. - -int -Nestea_Client_i::parse_args (void) -{ - ACE_Get_Opt get_opts (argc_, argv_, "dsn:k:"); - int c; - - while ((c = get_opts ()) != -1) - switch (c) - { - case 'd': // debug flag - TAO_debug_level++; - break; - case 'k': // ior provide on command line - this->server_key_ = ACE::strnew (get_opts.opt_arg ()); - break; - case 's': // shutdown server before exiting - this->shutdown_server_ = true; - break; - case '?': - default: - ACE_ERROR_RETURN ((LM_ERROR, - "usage: %s" - " [-d]" - " [-n loopcount]" - " [-s]" - " [-k server-object-key]" - "\n", - this->argv_ [0]), - -1); - } - - // Indicates successful parsing of command line. - return 0; -} - -// Execute client example code. - -int -Nestea_Client_i::run () -{ - this->server_->drink (40); - this->server_->drink (100); - - ACE_DEBUG ((LM_DEBUG, "Cans: %d\n" - "Praise: %s\n", - this->server_->bookshelf_size (), - this->server_->get_praise ())); - - this->server_->drink (500); - this->server_->crush (200); - - ACE_DEBUG ((LM_DEBUG, "Cans: %d\n" - "Praise: %s\n", - this->server_->bookshelf_size (), - this->server_->get_praise ())); - - if (shutdown_server_) - server_->shutdown(); - - return 0; -} - -Nestea_Client_i::~Nestea_Client_i (void) -{ - // Free resources - CORBA::release (this->server_); - - delete [] this->server_key_; -} - - -int -Nestea_Client_i::init (int argc, char **argv) -{ - this->argc_ = argc; - this->argv_ = argv; - - ACE_DECLARE_NEW_CORBA_ENV; - ACE_TRY - { - // Retrieve the ORB. - this->orb_ = CORBA::ORB_init (this->argc_, - this->argv_, - "internet" - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Parse command line and verify parameters. - if (this->parse_args () == -1) - return -1; - - if (this->server_key_ == 0) - ACE_ERROR_RETURN ((LM_ERROR, - "%s: no server key specified\n", - this->argv_[0]), - -1); - - CORBA::Object_var server_object = - this->orb_->string_to_object (this->server_key_ ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - this->server_ = Nestea_Bookshelf::_narrow (server_object.in() ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (CORBA::is_nil (server_object.in ())) - ACE_ERROR_RETURN ((LM_ERROR, - "Error: invalid server key <%s>\n", this->server_key_), -1); - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Nestea_Client_i::init"); - return -1; - } - ACE_ENDTRY; - - return 0; -} |