Merge pull request #2306 from mitza-oci/warnings
[ACE_TAO.git] / TAO / examples / Simple / chat / Client_i.h
blobbeb17fffb9d98816eac033ae728fd49780338c88
1 /* -*- C++ -*- */
3 //=============================================================================
4 /**
5 * @file Client_i.h
7 * Definition of the Chat Client class, Client_i.
9 * @author Pradeep Gore <pradeep@cs.wustl.edu>
11 //=============================================================================
14 #ifndef CLIENT_I_H
15 #define CLIENT_I_H
17 #include "Receiver_i.h"
18 #include "BroadcasterC.h"
19 #include "ace/Read_Buffer.h"
20 #include "ace/Event_Handler.h"
21 #include "ace/SString.h"
23 #if !defined (ACE_LACKS_PRAGMA_ONCE)
24 # pragma once
25 #endif /* ACE_LACKS_PRAGMA_ONCE */
27 #include "tao/Utils/ORB_Manager.h"
28 #include "tao/Intrusive_Ref_Count_Handle_T.h"
30 /**
31 * @class Client_i
33 * @brief Chat Client class.
35 * Connects to the Chat server and registers the Receiver_i
36 * object with the chat server. It also takes in user chat
37 * messages and sends them to the server.
39 class Client_i : public ACE_Event_Handler
41 public:
42 /// Constructor.
43 Client_i ();
45 /// Initialize the client communication with the server.
46 int init (int argc, ACE_TCHAR *argv[]);
48 /// Start the ORB object.
49 int run ();
51 /// Handle the user input.
52 virtual int handle_input (ACE_HANDLE);
54 private:
55 /// Parse the command line arguments.
56 /// Returns 0 on success, -1 on error.
57 int parse_args (int argc, ACE_TCHAR *argv[]);
59 /// Function to read the server ior from a file.
60 int read_ior (const ACE_TCHAR *filename);
62 /// IOR of the obj ref of the server.
63 ACE_CString ior_;
65 /// The filename that stores the ior of the server
66 const ACE_TCHAR* ior_file_name_;
68 /// Nickname of the user chatting.
69 ACE_CString nickname_;
71 /// Our orb.
72 TAO_ORB_Manager orb_manager_;
74 /// Server object ptr.
75 Broadcaster_var server_;
77 /// The receiver object.
78 typedef TAO_Intrusive_Ref_Count_Handle<Receiver_i> Receiver_i_var;
79 Receiver_i_var receiver_i_;
81 /// Pointer to the receiver object registered with the ORB.
82 Receiver_var receiver_var_;
85 #define QUIT_STRING "quit"
86 // The string that the user must type to quit the chat.
88 #endif /* CLIENT_I_H */