summaryrefslogtreecommitdiff
path: root/TAO/tests/Cubit/TAO/IDL_Cubit
diff options
context:
space:
mode:
authorschmidt <douglascraigschmidt@users.noreply.github.com>1998-02-25 03:28:47 +0000
committerschmidt <douglascraigschmidt@users.noreply.github.com>1998-02-25 03:28:47 +0000
commit2be3734a6e191dcea69dc62d659714edbd3ca214 (patch)
tree09894ebfb1b7c2d6b7ae379a84f3640143a2924d /TAO/tests/Cubit/TAO/IDL_Cubit
parenta124333b36a99052297c6a5ac3922852e231ad90 (diff)
downloadATCD-2be3734a6e191dcea69dc62d659714edbd3ca214.tar.gz
*** empty log message ***
Diffstat (limited to 'TAO/tests/Cubit/TAO/IDL_Cubit')
-rw-r--r--TAO/tests/Cubit/TAO/IDL_Cubit/client.cpp143
-rw-r--r--TAO/tests/Cubit/TAO/IDL_Cubit/client.h26
-rw-r--r--TAO/tests/Cubit/TAO/IDL_Cubit/server.cpp1
3 files changed, 84 insertions, 86 deletions
diff --git a/TAO/tests/Cubit/TAO/IDL_Cubit/client.cpp b/TAO/tests/Cubit/TAO/IDL_Cubit/client.cpp
index 141858e2624..b28d9968256 100644
--- a/TAO/tests/Cubit/TAO/IDL_Cubit/client.cpp
+++ b/TAO/tests/Cubit/TAO/IDL_Cubit/client.cpp
@@ -1,22 +1,5 @@
// $Id$
-// ============================================================================
-//
-// = LIBRARY
-// TAO/tests/IDL_Cubit
-//
-// = FILENAME
-// clnt.cpp
-//
-// = DESCRIPTION
-// This class implements a simple "cube" CORBA client for the Cubit
-// example using stubs generated by the TAO ORB IDL compiler.
-//
-// = AUTHORS
-// Aniruddha Gokhale, Sumedh Mungee, and Sergio Flores-Gaitan
-//
-// ============================================================================
-
#include "ace/Profile_Timer.h"
#include "ace/Env_Value_T.h"
#include "client.h"
@@ -54,44 +37,49 @@ int
Cubit_Client::read_ior (char *filename)
{
struct stat f_stat;
- int result,
- ior_size;
- char *gets_result = 0;
- // Open the file for reading
+ // Open the file for reading.
this->f_handle_ = ACE_OS::open (filename,0);
+
if (this->f_handle_ == ACE_INVALID_HANDLE)
ACE_ERROR_RETURN ((LM_ERROR,
"Unable to open %s for writing: %p\n",
- filename), -1);
- result = ACE_OS::fstat (this->f_handle_,&f_stat);
+ filename),
+ -1);
+
+ int result = ACE_OS::fstat (this->f_handle_,
+ &f_stat);
if (result == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "Unable to stat %s for file size: %p\n",
- filename), -1);
- }
- ior_size = f_stat.st_size+1;
- ACE_NEW_RETURN (this->cubit_factory_key_,char [ior_size],-1);
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Unable to stat %s for file size: %p\n",
+ filename),
+ -1);
+ int ior_size = f_stat.st_size + 1;
+
+ ACE_NEW_RETURN (this->cubit_factory_key_,
+ char [ior_size],
+ -1);
+
if (this->cubit_factory_key_ == 0)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "Unable to allocate memory to read ior: %p\n"
- ), -1);
- }
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Unable to allocate memory to read ior: %p\n"),
+ -1);
cubit_factory_ior_file_ = ACE_OS::fdopen (this->f_handle_,
"r");
if (this->cubit_factory_ior_file_ == 0)
ACE_ERROR_RETURN ((LM_ERROR,
"Unable to open %s for writing: %p\n",
- filename), -1);
- gets_result = ACE_OS::fgets (this->cubit_factory_key_,
- ior_size,
- this->cubit_factory_ior_file_);
- if (gets_result == 0 )
+ filename),
+ -1);
+
+ char *gets_result = ACE_OS::fgets (this->cubit_factory_key_,
+ ior_size,
+ this->cubit_factory_ior_file_);
+ if (gets_result == 0)
ACE_ERROR_RETURN ((LM_ERROR,
"Unable to read cubit_factory_ior from file %s: %p\n",
- filename), -1);
+ filename),
+ -1);
return 0;
}
@@ -111,17 +99,19 @@ Cubit_Client::parse_args (void)
TAO_debug_level++;
break;
case 'n': // loop count
- loop_count_ = (u_int) ACE_OS::atoi (get_opts.optarg);
+ this->loop_count_ = (u_int) ACE_OS::atoi (get_opts.optarg);
break;
case 'f': // read the IOR from the file.
result = this->read_ior (get_opts.optarg);
if (result < 0)
ACE_ERROR_RETURN ((LM_ERROR,
- "Unable to read ior from %s : %p\n",
- get_opts.optarg), -1);
+ "Unable to read ior from %s : %p\n",
+ get_opts.optarg),
+ -1);
break;
case 'k': // read the cubit IOR from the command-line.
- this->cubit_factory_key_ = ACE_OS::strdup (get_opts.optarg);
+ this->cubit_factory_key_ =
+ ACE_OS::strdup (get_opts.optarg);
break;
case 'x':
this->shutdown_ = 1;
@@ -251,7 +241,10 @@ Cubit_Client::cube_union_dii (void)
CORBA::Any tmp_arg (Cubit::_tc_oneof, u, CORBA::B_FALSE);
- req->arguments ()->add_value ("values", tmp_arg, CORBA::ARG_IN, this->env_);
+ req->arguments ()->add_value ("values",
+ tmp_arg,
+ CORBA::ARG_IN,
+ this->env_);
if (this->env_.exception () != 0)
{
@@ -264,7 +257,10 @@ Cubit_Client::cube_union_dii (void)
// @@ Naga, please check with Andy and see if we can update all uses
// of the Any methods with the new <<= and >>= operators. Please
// make sure you document what is going on here if you do this.
- req->result ()->value ()->replace (Cubit::_tc_oneof, 0, CORBA::B_TRUE, this->env_);
+ req->result ()->value ()->replace (Cubit::_tc_oneof,
+ 0,
+ CORBA::B_TRUE,
+ this->env_);
if (this->env_.exception () != 0)
{
@@ -386,13 +382,15 @@ Cubit_Client::cube_long (int i)
{
dmsg2 ("cube long: %d --> %d\n", arg_long, ret_long);
arg_long = arg_long * arg_long * arg_long;
- if (arg_long != ret_long) {
- ACE_ERROR ((LM_ERROR,
- "** cube_long (%ld) ERROR (--> %ld)\n",
- (CORBA::Long) this->func (i),
- ret_long));
- this->error_count_++;
- }
+
+ if (arg_long != ret_long)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "** cube_long (%ld) ERROR (--> %ld)\n",
+ (CORBA::Long) this->func (i),
+ ret_long));
+ this->error_count_++;
+ }
}
}
@@ -447,9 +445,7 @@ Cubit_Client::cube_sequence (int i)
// Fill in the input sequence...
for (int j = 0; j < i + 1; ++j)
- {
- input[j] = j;
- }
+ input[j] = j;
Cubit::vector_var output;
Cubit::vector_out vout (output);
@@ -475,9 +471,7 @@ Cubit_Client::cube_sequence (int i)
u_int l = output->length ();
if (input.length () < l)
- {
- l = input.length ();
- }
+ l = input.length ();
for (u_int j = 0; j < l; ++j)
{
int x = input[j];
@@ -517,7 +511,9 @@ Cubit_Client::cube_struct_dii (void)
CORBA::Any tmp_arg (Cubit::_tc_Many, &arg, CORBA::B_FALSE);
- req->arguments ()->add_value ("values", tmp_arg, CORBA::ARG_IN, this->env_);
+ req->arguments ()->add_value ("values",
+ tmp_arg,
+ CORBA::ARG_IN, this->env_);
if (this->env_.exception () != 0)
{
@@ -526,7 +522,10 @@ Cubit_Client::cube_struct_dii (void)
return;
}
- req->result ()->value ()->replace (Cubit::_tc_Many, 0, CORBA::B_TRUE, this->env_);
+ req->result ()->value ()->replace (Cubit::_tc_Many,
+ 0,
+ CORBA::B_TRUE,
+ this->env_);
if (this->env_.exception () != 0)
{
@@ -564,7 +563,7 @@ Cubit_Client::print_stats (const char *call_name,
"%s:\n",
call_name));
- if (this->call_count_ > 0 && this->error_count_ == 0)
+ if (this->call_count_ > 0 && this->error_count_ == 0)
{
double tmp = 1000 / elapsed_time.real_time;
@@ -754,11 +753,9 @@ Cubit_Client::init_naming_service (void)
TAO_CHECK_ENV;
if (CORBA::is_nil (this->factory_.in ()))
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- " could not resolve cubit factory in Naming service <%s>\n"),
- -1);
- }
+ ACE_ERROR_RETURN ((LM_ERROR,
+ " could not resolve cubit factory in Naming service <%s>\n"),
+ -1);
}
TAO_CATCHANY
{
@@ -815,12 +812,10 @@ Cubit_Client::init (int argc, char **argv)
TAO_CHECK_ENV;
if (CORBA::is_nil (this->factory_.in ()))
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "invalid factory key <%s>\n",
- this->cubit_factory_key_),
- -1);
- }
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "invalid factory key <%s>\n",
+ this->cubit_factory_key_),
+ -1);
}
ACE_DEBUG ((LM_DEBUG, "Factory received OK\n"));
diff --git a/TAO/tests/Cubit/TAO/IDL_Cubit/client.h b/TAO/tests/Cubit/TAO/IDL_Cubit/client.h
index 15b1259534d..205914e2369 100644
--- a/TAO/tests/Cubit/TAO/IDL_Cubit/client.h
+++ b/TAO/tests/Cubit/TAO/IDL_Cubit/client.h
@@ -7,7 +7,7 @@
// TAO/tests/IDL_Cubit
//
// = FILENAME
-// clnt.h
+// client.h
//
// = DESCRIPTION
// This class implements a simple "cube" CORBA client for the Cubit
@@ -46,34 +46,36 @@ public:
private:
int init_naming_service (void);
- // function to initialize the naming service
+ // Function to initialize the naming service.
int func (u_int i);
- // simple function that returns the substraction of 117 from the parameter.
+ // Simple function that returns the substraction of 117 from the
+ // parameter.
int read_ior (char *filename);
- // function to read the cubit factory ior from a file
+ // Function to read the cubit factory ior from a file.
int parse_args (void);
// Parses the arguments passed on the command line.
- void print_stats (const char *call_name, ACE_Profile_Timer::ACE_Elapsed_Time &elapsed_time);
- // prints the time stats
+ void print_stats (const char *call_name,
+ ACE_Profile_Timer::ACE_Elapsed_Time &elapsed_time);
+ // Prints the time stats.
void cube_union_stub (void);
// Exercise the union. Cube a union.
void cube_union_dii (void);
- // Exercise the union using dii.
+ // Exercise the union using DII.
void cube_struct (int i);
// calculate the cube from a struct.
void cube_long (int i);
- // calculate the cube from a long
+ // calculate the cube from a long.
void cube_octet (int i);
- // Cube an octet
+ // Cube an octet.
void cube_short (int i);
// Cube a short.
@@ -100,7 +102,7 @@ private:
// Number of times to do the cube operations.
int shutdown_;
- // Flag to tell server to shutdown.
+ // Flag to tell server to shutdown.
Cubit_Factory_var factory_;
// factory pointer for cubit.
@@ -118,13 +120,13 @@ private:
// # of calls made to functions.
u_int error_count_;
- // # of errors incurred in the lifetime of the application.
+ // # of errors incurred in the lifetime of the application.
FILE *cubit_factory_ior_file_;
// File from which to obtain the IOR.
ACE_HANDLE f_handle_;
- // File handle to read the IOR
+ // File handle to read the IOR.
int use_naming_service_;
// Flag to tell client to use Namingservice to find the cubit
diff --git a/TAO/tests/Cubit/TAO/IDL_Cubit/server.cpp b/TAO/tests/Cubit/TAO/IDL_Cubit/server.cpp
index 270dd3074fc..ad88e633942 100644
--- a/TAO/tests/Cubit/TAO/IDL_Cubit/server.cpp
+++ b/TAO/tests/Cubit/TAO/IDL_Cubit/server.cpp
@@ -1,3 +1,4 @@
+// $Id$
#include "server.h"