diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 1999-01-16 20:06:24 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 1999-01-16 20:06:24 +0000 |
commit | 3606d50cc6388864e8aadb1929f80befc5a1b6d4 (patch) | |
tree | 3eddbe6a86c1f8870247eeb2f2505c9ea6aa1af7 | |
parent | aab791d26e22105e36e2e20959e08efeb0e71f88 (diff) | |
download | ATCD-3606d50cc6388864e8aadb1929f80befc5a1b6d4.tar.gz |
.
-rw-r--r-- | TAO/examples/Simple/Simple_util.cpp | 27 | ||||
-rw-r--r-- | TAO/examples/Simple/Simple_util.h | 39 | ||||
-rw-r--r-- | TAO/examples/Simple/time/Time_Client_i.cpp | 18 | ||||
-rw-r--r-- | TAO/examples/Simple/time/Time_Client_i.h | 16 | ||||
-rw-r--r-- | TAO/examples/Simple/time/client.cpp | 2 | ||||
-rw-r--r-- | TAO/examples/Simple/time/server.cpp | 6 |
6 files changed, 68 insertions, 40 deletions
diff --git a/TAO/examples/Simple/Simple_util.cpp b/TAO/examples/Simple/Simple_util.cpp index 356bc8fecf5..d4df63fd206 100644 --- a/TAO/examples/Simple/Simple_util.cpp +++ b/TAO/examples/Simple/Simple_util.cpp @@ -2,21 +2,23 @@ # include "Simple_util.h" // Constructor. + template <class Servant> -Server<Servant>::Server () +Server<Servant>::Server () // @@ Bala, please fix the "() -> (void)". : ior_output_file_ (0) { // no-op. } // Destructor. + template <class Servant> Server<Servant>::~Server () { } - // Parse the command-line arguments and set options. + template <class Servant> int Server<Servant>::parse_args () { @@ -78,16 +80,19 @@ int Server<Servant>::init (const char *servant_name, if (retval != 0) return retval; - CORBA::ORB_var orb = this->orb_manager_.orb (); // Stash our ORB pointer for later reference. this->servant_.orb (orb.in ()); + // Save name in case we use TAO Naming Service. + name = servant_name; // Activate the servant in its own child POA. - name = servant_name; // save name in case we use TAO Naming Service + + // Make sure that you check for failures here via the TAO_TRY + // macros?! CORBA::String_var str = this->orb_manager_.activate_under_child_poa (servant_name, &this->servant_, @@ -110,6 +115,8 @@ int Server<Servant>::init (const char *servant_name, template <class Servant> int Server<Servant>::run (CORBA::Environment &env) { + // @@ Bala, please indent.. + // Run the main event loop for the ORB. if (this->orb_manager_.run (env) == -1) ACE_ERROR_RETURN ((LM_ERROR, @@ -119,9 +126,8 @@ int Server<Servant>::run (CORBA::Environment &env) return 0; } - template <class Servant> -void Server<Servant>::register_name() +void Server<Servant>::register_name () { namingClient.init(orb_manager_.orb()); // create the name for the naming service @@ -133,12 +139,14 @@ void Server<Servant>::register_name() // (re)Bind the object. TAO_TRY { + // @@ Bala, please make sure to put a ' ' between this and '(' CORBA::Object_var object = servant_._this(TAO_TRY_ENV); TAO_CHECK_ENV; + // @@ Bala, please make sure to put a ' ' between this and '(' namingClient->bind(bindName, - object.in(), - TAO_TRY_ENV); + object.in(), + TAO_TRY_ENV); TAO_CHECK_ENV; } TAO_CATCH (CosNaming::NamingContext::AlreadyBound, ex) @@ -153,8 +161,8 @@ void Server<Servant>::register_name() } - // Constructor. + template <class InterfaceObj, class Var> Client<InterfaceObj, Var>::Client () : ior_ (0) @@ -192,6 +200,7 @@ int Client<InterfaceObj, Var>::read_ior (char *filename) } // Parses the command line arguments and returns an error status. + template <class InterfaceObj, class Var> int Client<InterfaceObj, Var>::parse_args () { diff --git a/TAO/examples/Simple/Simple_util.h b/TAO/examples/Simple/Simple_util.h index 62a7bba5b71..483b2adce96 100644 --- a/TAO/examples/Simple/Simple_util.h +++ b/TAO/examples/Simple/Simple_util.h @@ -1,4 +1,5 @@ //$Id$ + // ============================================================================ // // = LIBRARY @@ -11,12 +12,10 @@ // The classe define the templates for the client and server. // // = AUTHOR -// +// @@ Bala, please add yourself here! // // ============================================================================ - -// A set of useful class Templates for using the TAO CORBA implementation. #ifndef TAO_UTIL_H #define TAO_UTIL_H @@ -28,8 +27,15 @@ template <class Servant> class Server { + // = TITLE + // A set of useful class Templates for using the TAO CORBA implementation. + // + // = DESCRIPTION + // @@ Bala, please fill in a brief description here. public: // = Initialization and termination methods. + + // @@ Bala, please use "Server (void)", etc. for all "()" in your code! Server (); // Constructor. @@ -40,12 +46,12 @@ public: int argc, char *argv[], CORBA::Environment &env); - // Initialize the Server state - parsing arguments and waiting. - // interface_name is the name used to register the Servant. + // Initialize the Server state - parsing arguments and waiting. + // interface_name is the name used to register the Servant. void register_name (); - // after calling init(), this method will register the server - // with the TAO Naming Service using the servant_name passed to init(). + // after calling init(), this method will register the server with + // the TAO Naming Service using the servant_name passed to init(). int run (CORBA::Environment &env); // Run the orb. @@ -61,11 +67,11 @@ protected: // Parses the commandline arguments. TAO_ORB_Manager orb_manager_; - // The ORB manager - a helper class for accessing the POA and registering - // objects. + // The ORB manager - a helper class for accessing the POA and + // registering objects. TAO_Naming_Client namingClient; - // helper class for getting access to Naming Service + // helper class for getting access to Naming Service. FILE *ior_output_file_; // File where the IOR of the server object is stored. @@ -77,12 +83,19 @@ protected: // The command line arguments. }; - template <class InterfaceObj, class Var> class Client { + // = TITLE + // @@ Bala, please fill in a brief description here. + // + // = DESCRIPTION + // @@ Bala, please fill in a brief description here. public: + // @@ Bala, please reformat this stuff to use ACE indenting and map + // "()" to "(void)"! + // = Initialization and termination methods. Client (); // Constructor. @@ -93,6 +106,8 @@ public: int init (int argc, char *argv[]); // Initialize the client communication endpoint with server. + // @@ Bala, please don't inline this in the header file, and also + // remove the inline keyword. inline InterfaceObj *operator-> () { return server_.in ();}; // Return the interface object pointer. @@ -101,6 +116,7 @@ public: void shutdown (int); // Fills in the shutdwon flag. + protected: int read_ior (char *filename); // Function to read the server IOR from a file. @@ -129,4 +145,5 @@ protected: CORBA::ORB_var orb_; // Remember our orb. }; + #endif /* TAO_UTIL_H */ diff --git a/TAO/examples/Simple/time/Time_Client_i.cpp b/TAO/examples/Simple/time/Time_Client_i.cpp index bf4a52607a1..3e345da603d 100644 --- a/TAO/examples/Simple/time/Time_Client_i.cpp +++ b/TAO/examples/Simple/time/Time_Client_i.cpp @@ -1,29 +1,32 @@ - //$Id$ + #include "Time_Client_i.h" -// This is the interface program that -// accesses the remote object +// This is the interface program that accesses the remote object // Constructor. +// @@ Bala, please watch the formatting stuff.. Time_Client_i::Time_Client_i( void) { //no-op } //Destructor. +// @@ Bala, please watch the formatting stuff.. Time_Client_i::~Time_Client_i( void) { //no-op } - int Time_Client_i::run (int argc, char** argv) { - // Instantiation of template with the - // interface object and its _var object + // Instantiation of template with the interface object and its _var + // object. + + // @@ Bala, just for fun, why don't you put this as a private data + // member in the Time_Client_i class. Client<Time, Time_var> client; // Initialize the client @@ -39,16 +42,17 @@ Time_Client_i::run (int argc, char *ascii_timedate = ACE_OS::ctime (ACE_reinterpret_cast (time_t *, &timedate)); - ACE_DEBUG ((LM_DEBUG, "string time is %s\n", ascii_timedate)); + // @@ Bala, watch the formatting stuff.. if ( client.shutdown () == 1) client->shutdown (TAO_TRY_ENV); } TAO_CATCHANY { + // @@ Bala, watch the formatting stuff.. TAO_TRY_ENV.print_exception("\tException"); } TAO_ENDTRY; diff --git a/TAO/examples/Simple/time/Time_Client_i.h b/TAO/examples/Simple/time/Time_Client_i.h index 74ad3e538b2..fa39c97b659 100644 --- a/TAO/examples/Simple/time/Time_Client_i.h +++ b/TAO/examples/Simple/time/Time_Client_i.h @@ -1,5 +1,6 @@ // -*- C++ -*- // $Id$ + // ============================================================================ // // = LIBRARY @@ -12,9 +13,9 @@ // This class implements the interface calls for RMI. // // = AUTHOR +// @@ Bala, please update the author! // Darrell Brunsch <brunsch@cs.wustl.edu> // -// // ============================================================================ #ifndef TIME_CLIENT_I_H @@ -29,24 +30,19 @@ class Time_Client_i // Time_Client interface subclass. // // = DESCRIPTION - // This class implements the interface between the - // interface objects and the client . - - public: + // This class implements the interface between the interface + // objects and the client . +public: // = Initialization and termination methods. - Time_Client_i (void); // Constructor ~Time_Client_i (void); // Destructor - virtual int run (int, char** ); + virtual int run (int, char** ); // Execute the methods - - private: - }; #endif /* TIME_CLIENT_I_H */ diff --git a/TAO/examples/Simple/time/client.cpp b/TAO/examples/Simple/time/client.cpp index bd6b92aea09..9d2a1f46655 100644 --- a/TAO/examples/Simple/time/client.cpp +++ b/TAO/examples/Simple/time/client.cpp @@ -1,6 +1,6 @@ //$Id$ -# include "Time_Client_i.h" +# include "Time_Client_i.h" // The client program for the application. diff --git a/TAO/examples/Simple/time/server.cpp b/TAO/examples/Simple/time/server.cpp index 89661d83e1f..147b19c1643 100644 --- a/TAO/examples/Simple/time/server.cpp +++ b/TAO/examples/Simple/time/server.cpp @@ -2,7 +2,6 @@ #include "../Simple_util.h" #include "Time_i.h" - // This is the main driver program for the time and date server. int @@ -15,7 +14,10 @@ main (int argc, char *argv[]) TAO_TRY { - if (server.init ("Time", argc, argv, TAO_TRY_ENV) == -1) + if (server.init ("Time", + argc, + argv, + TAO_TRY_ENV) == -1) return 1; else { |