Merge pull request #2303 from jwillemsen/jwi-803
[ACE_TAO.git] / TAO / orbsvcs / Concurrency_Service / Concurrency_Service.h
blobc630331101b031ca092fda74c508d821cbfafb70
2 //=============================================================================
3 /**
4 * @file Concurrency_Service.h
6 * This class implements a subset of the functionality of the
7 * CORBA Concurrency Service.
9 * @author Torben Worm <tworm@cs.wustl.edu>
11 //=============================================================================
14 #ifndef _CONCURRENCY_SERVICE_H
15 #define _CONCURRENCY_SERVICE_H
17 #include "ace/Get_Opt.h"
19 #if !defined (ACE_LACKS_PRAGMA_ONCE)
20 # pragma once
21 #endif /* ACE_LACKS_PRAGMA_ONCE */
23 #include "ace/Log_Msg.h"
24 #include "tao/Utils/ORB_Manager.h"
25 #include "orbsvcs/Concurrency/Concurrency_Utils.h"
26 #include "orbsvcs/Naming/Naming_Client.h"
28 /**
29 * @class Concurrency_Service
31 * @brief Defines a class that encapsulates the implementation of the
32 * concurrency service.
34 * This class uses the TAO_ORB_Manager, the TAO_Naming_Client, and
35 * the TAO_Concurrency_Server classes to implement a server for
36 * the concurrency service.
38 class Concurrency_Service : public TAO_ORB_Manager
40 public:
41 /// Default Constructor.
42 Concurrency_Service ();
44 /// Constructor taking the command-line arguments.
45 Concurrency_Service (int argc,
46 ACE_TCHAR **argv);
48 /// Destructor.
49 ~Concurrency_Service ();
51 /// Initialize the Concurrency Service with the arguments.
52 int init (int argc,
53 ACE_TCHAR **argv);
55 /// Run the Concurrency_Service.
56 int run ();
58 private:
59 /// Parses the commandline arguments.
60 int parse_args (int argc, ACE_TCHAR** argv);
62 /**
63 * Initialize the name server and register the concurency server
64 * factory with it. Maybe later it will be convinient to register
65 * the individual lock sets with the naming service. At present the
66 * clients must keep track of the reference and pass 'by hand'
68 int init_naming_service ();
70 /// Flag to tell wheter the naming service will be used.
71 int use_naming_service_;
73 /// The name of the file where we output the IOR.
74 const ACE_TCHAR *ior_file_name_;
76 /// The name of a file where the process stores its pid.
77 const ACE_TCHAR *pid_file_name_;
79 /// The ORB manager
80 TAO_ORB_Manager orb_manager_;
82 /// An instance of the name client used for registering the factory
83 /// objects.
84 TAO_Naming_Client naming_client_;
86 /// An instance of the concurrency server.
87 TAO_Concurrency_Server my_concurrency_server_;
89 /// Factory var to register with the naming service.
90 CosConcurrencyControl::LockSetFactory_var lockset_factory_;
92 /// Naming context for the concurrency service.
93 CosNaming::NamingContext_var concurrency_context_;
95 /// Naming context for the naming service.
96 CosNaming::NamingContext_var naming_context_;
99 #endif /* _CONCURRENCY_SERVICE_H */