summaryrefslogtreecommitdiff
path: root/trunk/TAO/orbsvcs/Concurrency_Service/Concurrency_Service.h
blob: e5f0c5e133bb06d6d6119305e64534832ffab12d (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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103

//=============================================================================
/**
 *  @file    Concurrency_Service.h
 *
 *  $Id$
 *
 *    This class implements a subset of the functionality of the
 *    CORBA Concurrency Service.
 *
 *
 *  @author Torben Worm <tworm@cs.wustl.edu>
 */
//=============================================================================


#ifndef _CONCURRENCY_SERVICE_H
#define _CONCURRENCY_SERVICE_H

#include "ace/Get_Opt.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

#include "ace/Log_Msg.h"
#include "tao/Utils/ORB_Manager.h"
#include "orbsvcs/Concurrency/Concurrency_Utils.h"
#include "orbsvcs/Naming/Naming_Client.h"

/**
 * @class Concurrency_Service
 *
 * @brief Defines a class that encapsulates the implementation of the
 * concurrency service.
 *
 * This class uses the TAO_ORB_Manager, the TAO_Naming_Client, and
 * the TAO_Concurrency_Server classes to implement a server for
 * the concurrency service.
 */
class Concurrency_Service : public TAO_ORB_Manager
{
public:
  // = Initialization and termination methods.
  /// Default Constructor.
  Concurrency_Service (void);

  /// Constructor taking the command-line arguments.
  Concurrency_Service (int argc,
                       ACE_TCHAR **argv);

  /// Destructor.
  ~Concurrency_Service (void);

  /// Initialize the Concurrency Service with the arguments.
  int init (int argc,
            ACE_TCHAR **argv);

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

private:
  /// Parses the commandline arguments.
  int parse_args (int argc, ACE_TCHAR** argv);

  /**
   * Initialize the name server and register the concurency server
   * factory with it. Maybe later it will be convinient to register
   * the individual lock sets with the naming service. At present the
   * clients must keep track of the reference and pass 'by hand'
   */
  int init_naming_service (void);

  /// Flag to tell wheter the naming service will be used.
  int use_naming_service_;

  /// The name of the file where we output the IOR.
  const char *ior_file_name_;

  /// The name of a file where the process stores its pid.
  const char *pid_file_name_;

  /// The ORB manager
  TAO_ORB_Manager orb_manager_;

  /// An instance of the name client used for registering the factory
  /// objects.
  TAO_Naming_Client naming_client_;

  /// An instance of the concurrency server.
  TAO_Concurrency_Server my_concurrency_server_;

  /// Factory var to register with the naming service.
  CosConcurrencyControl::LockSetFactory_var lockset_factory_;

  /// Naming context for the concurrency service.
  CosNaming::NamingContext_var concurrency_context_;

  /// Naming context for the naming service.
  CosNaming::NamingContext_var naming_context_;
};

#endif /* _CONCURRENCY_SERVICE_H */