Revert "Minor modernization of DynamicAny code"
[ACE_TAO.git] / TAO / tao / Strategies / advanced_resource.h
blobdb940110e70878be6635bcf7e3b3cd1f86fc92a0
1 // -*- C++ -*-
2 #ifndef TAO_ADVANCED_RESOURCE_H
3 #define TAO_ADVANCED_RESOURCE_H
4 #include /**/ "ace/pre.h"
6 #include "tao/Strategies/strategies_export.h"
7 #include "tao/default_resource.h"
9 #if !defined (ACE_LACKS_PRAGMA_ONCE)
10 # pragma once
11 #endif /* ACE_LACKS_PRAGMA_ONCE */
13 #include "tao/ORB_Core.h"
15 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
17 class TAO_Connection_Purging_Strategy;
19 class TAO_Strategies_Export TAO_Resource_Factory_Changer
21 public:
22 TAO_Resource_Factory_Changer ();
25 /**
26 * @class TAO_Advanced_Resource_Factory
28 * @brief TAO's default resource factory
30 * Using a <{resource source specifier}> as a discriminator, the
31 * factory can return resource instances which are, e.g., global,
32 * stored in thread-specific storage, stored in shared memory,
33 * etc.
35 class TAO_Strategies_Export TAO_Advanced_Resource_Factory :
36 public TAO_Default_Resource_Factory
38 public:
39 /// Constructor.
40 TAO_Advanced_Resource_Factory ();
42 /// Destructor.
43 virtual ~TAO_Advanced_Resource_Factory ();
45 // = Service Configurator hooks.
46 /// Dynamic linking hook
47 virtual int init (int argc, ACE_TCHAR* argv[]);
49 /// Type of lock used for the allocators
50 enum Allocator_Lock_Type
52 TAO_ALLOCATOR_NULL_LOCK,
53 TAO_ALLOCATOR_THREAD_LOCK
56 /// Type of Reactor
57 enum
59 /// Use ACE_Token
60 TAO_REACTOR_SELECT_MT = 1,
62 /// Use ACE_Noop_Token
63 TAO_REACTOR_SELECT_ST = 2,
64 TAO_REACTOR_WFMO = 3,
65 TAO_REACTOR_MSGWFMO = 4,
66 TAO_REACTOR_TP = 5,
67 TAO_REACTOR_DEV_POLL = 6
70 /// Thread queueing Strategy
71 enum
73 /// Not set, use LIFO.
74 TAO_THREAD_QUEUE_NOT_SET,
76 /// FIFO, first-in-first-out.
77 TAO_THREAD_QUEUE_FIFO,
79 /// LIFO, last-in-first-out (default).
80 TAO_THREAD_QUEUE_LIFO
83 /**
84 * @name Resource Retrieval
86 //@{
87 virtual int init_protocol_factories ();
88 virtual ACE_Allocator* input_cdr_dblock_allocator ();
89 virtual ACE_Allocator* input_cdr_buffer_allocator ();
90 virtual ACE_Allocator* input_cdr_msgblock_allocator ();
91 virtual ACE_Allocator* amh_response_handler_allocator ();
92 virtual ACE_Allocator* ami_response_handler_allocator ();
93 virtual int input_cdr_allocator_type_locked ();
94 virtual TAO_ProtocolFactorySet *get_protocol_factories ();
95 //@}
97 virtual TAO_Connection_Purging_Strategy *create_purging_strategy ();
98 virtual TAO_LF_Strategy *create_lf_strategy ();
100 protected:
101 /// Obtain the reactor implementation
102 virtual ACE_Reactor_Impl *allocate_reactor_impl () const;
104 void report_option_value_error (const ACE_TCHAR* option_name,
105 const ACE_TCHAR* option_value);
107 void report_unsupported_error (const ACE_TCHAR* option_name);
109 /// List of loaded protocol factories.
110 TAO_ProtocolFactorySet protocol_factories_;
112 /// Flag indicating which kind of reactor we should use.
113 int reactor_type_;
115 /// The type of queueing strategy to use for multi-threaded
116 /// select reactors, TAO_REACTOR_SELECT_MT and TAO_REACTOR_TP.
117 int threadqueue_type_;
119 /// The type of CDR allocators.
120 Allocator_Lock_Type cdr_allocator_type_;
122 /// Type of lock used by AMH response handler allocator.
123 Allocator_Lock_Type amh_response_handler_allocator_lock_type_;
125 /// Type of lock used by AMI response handler allocator.
126 Allocator_Lock_Type ami_response_handler_allocator_lock_type_;
128 virtual int load_default_protocols ();
131 static TAO_Resource_Factory_Changer TAO_changer;
134 ACE_STATIC_SVC_DECLARE_EXPORT (TAO_Strategies, TAO_Advanced_Resource_Factory)
135 ACE_FACTORY_DECLARE (TAO_Strategies, TAO_Advanced_Resource_Factory)
137 TAO_END_VERSIONED_NAMESPACE_DECL
139 #include /**/ "ace/post.h"
140 #endif /* TAO_ADVANCED_RESOURCE_H */