summaryrefslogtreecommitdiff
path: root/TAO/examples/Simple/chat/Server_i.h
blob: dd1e45624735bec7318223a28a33f67e361417d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/* -*- C++ -*- */

//=============================================================================
/**
 *  @file    Server_i.h
 *
 *  $Id$
 *
 *  Definition of the Chat Server_i class.
 *
 *
 *  @author Pradeep Gore <pradeep@cs.wustl.edu>
 */
//=============================================================================


#ifndef SERVER_I_H
#define SERVER_I_H

#include "Broadcaster_i.h"
#include "tao/Utils/ORB_Manager.h"
#include "tao/Intrusive_Ref_Count_Handle_T.h"

/**
 * @class Server_i
 *
 * @brief The class defines the server for the chat. It sets up the Orb
 * manager and registers the Broadcaster servant object.
 */
class Server_i
{

public:
  // = Initialization and termination methods.
  /// Constructor.
  Server_i (void);

  /// Destructor.
  ~Server_i (void);

  /// Initialize the server.
  int init (int argc,
            ACE_TCHAR *argv[]);

  /// Run the ORB.
  int run (void);

private:
  /// Parses the command line arguments.
  int parse_args (int argc, ACE_TCHAR *argv[]);

  /// Writes the server ior to a file, for the clients to pick up
  /// later.
  int write_IOR (const char *ior);

  /// The file name to save the ior to.
  const ACE_TCHAR *ior_file_name_;

  /// The tao orb manager object.
  TAO_ORB_Manager orb_manager_;

  /// The servant object registered with the orb.
  typedef TAO_Intrusive_Ref_Count_Handle<Broadcaster_i> Broadcaster_i_var;
  Broadcaster_i_var broadcaster_i_;
};

#endif /* SERVER_I_H */