3 //=============================================================================
7 * Header file for Loading DynamicTP Configurations.
11 //=============================================================================
13 #ifndef TAO_DYNAMIC_TP_CONFIG_H
14 #define TAO_DYNAMIC_TP_CONFIG_H
15 #include /**/ "ace/pre.h"
17 #include "tao/orbconf.h"
19 #if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
21 #include "tao/Dynamic_TP/dynamic_tp_export.h"
22 #include "ace/Service_Object.h"
23 #include "ace/Service_Config.h"
24 #include "ace/RB_Tree.h"
25 #include "ace/Synch.h"
27 #if !defined (ACE_LACKS_PRAGMA_ONCE)
29 #endif /* ACE_LACKS_PRAGMA_ONCE */
31 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
33 struct TAO_Dynamic_TP_Export TAO_DTP_Definition
35 int min_threads_
; // a default of -1 implies Lifespan of INFINITE, > 0 implies IDLE
36 int init_threads_
; // default to 5
37 int max_threads_
; // a default of -1 implies no limit.
39 ACE_Time_Value timeout_
; // default to 60 seconds
42 // Create explicit constructor to eliminate issues with non-initialized struct values.
43 TAO_DTP_Definition() :
47 stack_size_(ACE_DEFAULT_THREAD_STACKSIZE
),
52 class TAO_Dynamic_TP_Export TAO_DTP_Config_Registry_Installer
55 TAO_DTP_Config_Registry_Installer ();
58 class TAO_Dynamic_TP_Export TAO_DTP_Config_Registry
: public ACE_Service_Object
61 TAO_DTP_Config_Registry ();
62 virtual ~TAO_DTP_Config_Registry ();
64 virtual int init (int argc
, ACE_TCHAR
* []);
66 /// initializes the supplied set value with the configuration associated with the name, or returns false.
67 bool find (const ACE_CString
& name
, TAO_DTP_Definition
&entry
);
69 int bind (const ACE_CString
& name
, TAO_DTP_Definition
&entry
);
70 int rebind (const ACE_CString
& name
, TAO_DTP_Definition
&entry
);
73 typedef ACE_RB_Tree
<ACE_CString
, TAO_DTP_Definition
, ACE_Less_Than
<ACE_CString
>, ACE_Null_Mutex
> Registry
;
77 class TAO_Dynamic_TP_Export TAO_DTP_Config
: public ACE_Service_Object
84 virtual ~TAO_DTP_Config ();
86 /// Read a definition parameter set from the supplied args.
87 /// There must be a -TPName argument, which, if replicated will cause the set to be ignored, unless -TPOverwrite is also set
88 /// constriants: min threads <= initial threads <= max_threads.
89 /// defaults: min threads = initial = max = 5
90 /// default lifespan = infinite
91 /// idle timeout is in secondes, default = 60
92 /// default stack size = 0, system defined default used.
93 /// queue depth is in number of messages, default is infinite
94 /// Init can be called multiple times,
95 virtual int init (int argc
, ACE_TCHAR
* []);
98 int parse_long (int &curarg
, int argc
, ACE_TCHAR
* argv
[], const ACE_TCHAR
*match
, long &value
);
99 int parse_bool (int &curarg
, int argc
, ACE_TCHAR
* argv
[], const ACE_TCHAR
*match
, bool &value
);
100 int parse_string (int &curarg
, int argc
, ACE_TCHAR
* argv
[], const ACE_TCHAR
*match
, ACE_TCHAR
*&value
);
101 void report_option_value_error (const ACE_TCHAR
* option_name
,
102 const ACE_TCHAR
* option_value
);
105 static TAO_DTP_Config_Registry_Installer config_installer
;
108 ACE_STATIC_SVC_DECLARE_EXPORT (TAO_Dynamic_TP
, TAO_DTP_Config_Registry
)
109 ACE_FACTORY_DECLARE (TAO_Dynamic_TP
, TAO_DTP_Config_Registry
)
111 ACE_STATIC_SVC_DECLARE_EXPORT (TAO_Dynamic_TP
, TAO_DTP_Config
)
112 ACE_FACTORY_DECLARE (TAO_Dynamic_TP
, TAO_DTP_Config
)
114 TAO_END_VERSIONED_NAMESPACE_DECL
116 #endif /* (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0 */
118 #include /**/ "ace/post.h"
119 #endif /* TAO_DYNAMIC_TP_CONFIG_H */